不等于多个值的mysql语法
我正在尝试为下面的情况获取正确的语法不等于多个值的mysql语法,mysql,Mysql,我正在尝试为下面的情况获取正确的语法 SELECT * FROM wp_posts AS p WHERE post_type = 'post' AND post_status = 'publish' AND ID <> 5616,1095,1357,271,2784,902 ORDER BY post_title DESC 选择* 来自作为p的wp_职位 其中post_type='post' 和post_status='publish' 及身份证号码561610951357
SELECT *
FROM wp_posts AS p
WHERE post_type = 'post'
AND post_status = 'publish'
AND ID <> 5616,1095,1357,271,2784,902
ORDER BY post_title DESC
选择*
来自作为p的wp_职位
其中post_type='post'
和post_status='publish'
及身份证号码5616109513572712784902
邮购名称说明
您可以在(56161095…)中使用而不是
运算符比较单个左参数和右参数,看它们是否不相等。在您的例子中,您有一个左侧参数需要检查(我假设),以查看ID
是否不是右侧的任何值。因此,您应该使用ID NOT IN(5616109513572712784902)
以22秒的优势击败我。:-)+1,并删除我的答案。
SELECT *
FROM wp_posts AS p
WHERE post_type = 'post'
AND post_status = 'publish'
AND ID NOT IN (5616,1095,1357,271,2784,902)
ORDER BY post_title DESC
SELECT * FROM wp_posts AS p WHERE post_type = 'post'
AND post_status = 'publish' AND
ID NOT IN (5616,1095,1357,271,2784,902) ORDER BY post_title DESC