我有 2 张桌子,书和 temp_table。book : 中有 2 列book_id and tag_id
,而 temp_table ( tag_id
) 中只有 1 列。
我需要使用以下规则进行选择:
- 如果 book 具有 temp_table 中的所有标签,它将在结果中。
例如,有 3 本书。
First one has tag_id: 1,2,3,4.
Second - 1,3,4
Third - 1,2,3,5
并且 temp_table 包含 tag_id: 1,3,4
。
需要的选择必须包含第一和第二本书。3d 书不能在结果集中,因为它的 tag_id = 5,而 temp_table 中没有。