sql server query/subquery question
Posted
by parminder
on Stack Overflow
See other posts from Stack Overflow
or by parminder
Published on 2010-05-20T06:07:03Z
Indexed on
2010/05/20
6:10 UTC
Read the original article
Hit count: 203
Hi Experts, I have a tables with data like this
Id BookId TagId
34 113421 9
35 113421 10
36 113421 11
37 113421 1
38 113422 9
39 113422 1
40 113422 12
I need to write a query (SQL Server) which gives me data according to the tags say if I want bookIds where tagid =9 it should return bookid 113421 and 113422 as it exists in both the books, but If I ask data for tags 9 and 10 it should return only book 113421 as that is the only book where both the tags are present.
Thanks
Parminder
© Stack Overflow or respective owner