Filtering data in Mysql
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
精彩评论