我如何得到那些屬於國家79和筆者80和出版商的圖書編號91如何獲得對多列值的數據匹配在同一個表
SELECT id FROM books WHERE (
(filter = 'country' AND cat = 79)
AND
(filter = 'author' AND cat = 80)
AND
(filter = 'publisher' AND cat = 91)
)
這裏是我的表結構
+----+----------+-----+
| ID | FITER | CAT |
+----+----------+-----+
| 1 | country | 79 |
| 1 | author | 80 |
| 1 | publisher| 91 |
| 2 | country | 476 |
| 2 | author | 85 |
| 2 | publisher| 121 |
+----+----------+-----+
謝謝
所以,你想獲得這張表的前3條記錄?或者你想從其他表中獲取信息? – dotnetom
@dotnetom:我想只是得到id 1 – Mic