开发者

Filtering data in Mysql

开发者_Go百科

I know WHERE, LIKE, IN filters in database. But how can I filter with "except" ? I want to select all data except a specificdata. Thanks in advance


with NOT IN, usage is like IN

SELECT * FROM USERS WHERE ID NOT IN (1,2,3,4,5)


Three approaches:

WHERE column <> 'something' 
WHERE column NOT LIKE 'something' 
WHERE column not in('something')


you can use NOT IN


Note that you can use another query for NOT IN like this:

SELECT id FROM customers WHERE id NOT IN (SELECT id FROM bad_customers)


WHERE NOT LIKE

WHERE NOT IN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜