How do I list multiple items in MySQL?
What is the proper syntax for the below code:
SELECT * FROM this WHERE x = 'y' AND id != '10, 11, 143'
The part I am开发者_开发技巧 not sure about is listing multiple IDs.
if id
is numeric, you can use
SELECT * FROM this WHERE x = 'y' AND id not in (10,11,143)
or
SELECT * FROM this WHERE x = 'y' AND id not in ('10','11','143')
for strings.
精彩评论