using where in with AND
Posted: Fri Dec 07, 2007 5:10 pm
I have two tables:
Users
user_id
Ratings
user_id
by_user_id
rating
I'm trying to find which user_ids have not yet been rated by a specific user from a list of user_ids and return the rest... This is what I have below...
When I add the 'AND ratings.user_id != '66666666'' I get nothing....
Any ideas what I'm doing wrong?
Users
user_id
Ratings
user_id
by_user_id
rating
I'm trying to find which user_ids have not yet been rated by a specific user from a list of user_ids and return the rest... This is what I have below...
Code: Select all
SELECT users.user_id AS user_id, ratings.by_user_id as by_user_id
FROM users
LEFT JOIN ratings ON users.user_id = ratings.user_id
WHERE users.user_id
IN (
'503039', '1001359', '1506714', '1514587', '2237485', '2258441', '4704941', '5400415', '5708099', '5713117', '5713826', '8108791', '15200060', '15803712', '20800798', '25200094', '27000125', '31202619', '38004633', '73700472', '500298800', '500572691', '507151077', '508512579', '512696218', '557185747', '567142464', '582327844', '601599551', '653107128', '655493799', '657613062', '659913802', '669097874', '676297893', '736560493', '762208539', '822804126'
)
AND ratings.user_id != '66666666'
When I add the 'AND ratings.user_id != '66666666'' I get nothing....
Any ideas what I'm doing wrong?