Rommeo Posted January 28, 2012 Share Posted January 28, 2012 I m trying to get the photos that are not in the list.. and my query is this that is not working ; SELECT * FROM photos WHERE photoname NOT IN ( "one.jpg, two.jpg" ) ORDER BY visited ASC LIMIT 0 , 10 query gives me the 10 photos including one.jpg and two.jpg but weirdly when there is just one photo between the "IN" tags, it works, like; SELECT * FROM photos WHERE photoname NOT IN ( "one.jpg" ) ORDER BY visited ASC LIMIT 0 , 10 What am I missing here? any other keyword do I need to use here? PS : list is comma seperated like one.jpg,two.jpg,three.jpg Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted January 28, 2012 Share Posted January 28, 2012 each value that you are comparing against the specified field should be separated by a comma. SELECT * FROM photos WHERE photoname NOT IN ( "one.jpg, two.jpg" ) ORDER BY visited ASC LIMIT 0 , 10 this will check to make sure that the field value is not equal to the literal string "one.jpg,two.jpg". this is the correct query. SELECT * FROM photos WHERE photoname NOT IN ( "one.jpg", "two.jpg" ) ORDER BY visited ASC LIMIT 0 , 10 Quote Link to comment Share on other sites More sharing options...
Rommeo Posted January 28, 2012 Author Share Posted January 28, 2012 Yes, now it works, thanx! Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted January 28, 2012 Share Posted January 28, 2012 Edit to my post above: each value that you are comparing against the specified field should be separated by quotes Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 28, 2012 Share Posted January 28, 2012 Values are separated by commas. Further, string values are enclosed in quotes. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted January 28, 2012 Share Posted January 28, 2012 values are wrapped in quotes, separated by commas. im soooo sorry pika. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.