After checking out some answers on StackOverflow, it seems that this would not work on SQL Server. But that usually users defer to EXISTS
.
The examples I've found are all for subqueries (correlated ones). Whereas this is just an intersect statement. So, I'm hoping someone can show me how to implement multiple columns using a regular subquery. Smething like this:
select *
from person.person
where EXISTS (
select *
from (
(
select top 10 businessEntityid
from v
INTERSECT
select businessEntityid
from Person.Person
)
) as a
)
-
select *
from person.person
where EXISTS (
select * from (
(
select top 10 businessEntityid, firstname, lastname
from v
INTERSECT
select businessEntityid, firstname, lastname
from Person.Person
)
) as a
)
although, this doesn't seem to work - the sub query returns only 10 different businessids, while the overall query returns everything - almost as though the subquery isn't even used.
So an explanation of EXISTS
would be great here.
Thanks