The below query is resulting in above error
Select * from table 1 where territoryid exists in
(select 1.territoryid from tabale 2 inner join table 1 on 1.territoryid = 2.territoryid)
The below query is resulting in above error
Select * from table 1 where territoryid exists in
(select 1.territoryid from tabale 2 inner join table 1 on 1.territoryid = 2.territoryid)
Select * from [table 1] t1
where exists (select 1 from [table 2] t2 where t2.territoryid = t1.territoryid)
so when i am not specifying "where territoryid" in the condition, how does it ensure that territoryid is being compared ?
Also, thank you it worked.
Do you know why?
The territoryid is being compared in the EXISTS query:
(select 1 from [table 2] t2 where t2.territoryid = t1.territoryid)