开发者

How do I list multiple items in MySQL?

开发者 https://www.devze.com 2023-02-20 15:15 出处:网络
What is the proper syntax for the below code: SELECT * FROM this WHERE x = \'y\' AND id != \'10, 11, 143\'

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.

0

精彩评论

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