mysql syntax on not equal many values

Instead of <> , you can use NOT IN (5616,1095...)

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 

The <> operator compares a single left and right argument to see if they are not equal. In your case you have one left hand argument that needs to be checked (I assume) to see if the ID is none of the values on the right. Therefore you should use ID NOT IN (5616,1095,1357,271,2784,902)

Tags:

Mysql