I have 2 tables, book and temp_table.
There are 2 columns in book : book_id and tag_id, and only 1 column in temp_table (tag_id).
I need do selection used following rule:
- If book has ALL the tags from temp_table, it will be in result.
For example, there are 3 books.
First one has tag_id: 1,2,3,4.
Second - 1,3,4
Third - 1,2,3,5
And temp_table contains tag_id:1,3,4.
Needed selection has to contains 1st and 2nd books. 3d book must not be in result set because it has tag_id = 5, which there isnt in temp_table.
1 Answer