I've got TableA with userAId and UserBId.
I also got another TableB with UserId
I would like to select all records from TableA in which userAId and UserBId are in tableB
My solution is:
select * from TableA where
userAId IN
(
select UserId from Table B
)
and UserBId IN
(
select UserId from Table B
)
but i think that it is not the optimal solution as I do select UserId from Table B two times
Any other solutions?
Im using t-sql sql seerver 2008 R2