An expression of Non-boolean type specified in a context when a condition is expected near 'id'

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. :blush:

Do you know why?

The territoryid is being compared in the EXISTS query:

(select 1 from [table 2] t2 where t2.territoryid = t1.territoryid)