This is the MySQL query I am running:
SELECT *
FROM wp_social_stuff_events
WHERE `user_1_id` = 63
OR `user_1_id` = 143
OR `user_2_id` = 63
OR `user_2_id` = 143
ORDER BY `event_timestamp` DESC LIMIT 100
How would I use that query but say I don’t want any results where “user_1_id” is 53? I tried using AND user_1_id NOT 53
at the end but I can’t seem to get that to work either (not sure if it is the correct way)?
Any ideas?
You can use != or <> for not equal as you can read in the MySql documentation. It’s also require to have parentheses because AND is executed before OR. See MySql Operator Precedent.
would work as well (different than).
You need:
<> is the not equal operator in MySQL
See here:
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_not-equal