The multipart identifier could not be bound
-
Hi guys, I have the following query, example Select a.id, b.description from table1 a left join (select top 1 c.id, c.description from tableb c where c.id = a.id) as b on b.id = a.id The reason I do this is because tableb could have multiple duplicates of c.id and I want it to only do the select on one specific id from the table1. But I get the error because a.id is not within the select statement of tableb. Is there any way that I can do this, if I remove the where clause in the tableb select statement it returns duplicate values on the description. Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
Hi guys, I have the following query, example Select a.id, b.description from table1 a left join (select top 1 c.id, c.description from tableb c where c.id = a.id) as b on b.id = a.id The reason I do this is because tableb could have multiple duplicates of c.id and I want it to only do the select on one specific id from the table1. But I get the error because a.id is not within the select statement of tableb. Is there any way that I can do this, if I remove the where clause in the tableb select statement it returns duplicate values on the description. Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
Try this
Select a.id (select top 1 c.id from tableb c where c.id = a.id) , (select top 1 c.description from tableb c where c.id = a.id) from table1 a
I Love T-SQL "Don't torture yourself,let the life to do it for you."
-
Works, Thanks
No matter how long he who laughs last laughs, he who laughs first has a head start!