标签: mysql
此表名为category
我想选择Sid = 3和Bid = 0且不与Sid = 3和Bid = 8重复的记录
(我想选择图片中的红色记录)
http://img27.imageshack.us/img27/8127/6opr.jpg
答案 0 :(得分:2)
你可以像这样使用subquery:
SELECT * FROM Category WHERE Sid = 3 AND Bid = 0 AND Name NOT IN (SELECT Name FROM Category WHERE Sid = 3 AND Bid = 8)