Gmunky Posted August 8, 2007 Share Posted August 8, 2007 I want to write a query to retrieve information about users that are not in the list of userids.the list will be around 50 ids; is there a much simpler way than this: select * from user where userid != 23 AND userid != 24 AND userid != 46 AND so on.... Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 8, 2007 Share Posted August 8, 2007 Sure, use the NOT IN operator: SELECT * FROM `user` WHERE `userid` NOT IN (23,24,46) Quote Link to comment Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 Sure, use the NOT IN operator: SELECT * FROM `user` WHERE `userid` NOT IN (23,24,46) i guess there no not in operator it is the list operator when you use the IN and not i think is part of the logical operator which are and or not Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted August 9, 2007 Share Posted August 9, 2007 i guess there no not in operator it is the list operator when you use the IN and not i think is part of the logical operator which are and or not -->> yes u may use ds.... SELECT * FROM `user` WHERE `userid` NOT IN (23,24,46) Quote Link to comment Share on other sites More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 i guess there no not in operator it is the list operator when you use the IN and not i think is part of the logical operator which are and or not -->> yes u may use ds.... SELECT * FROM `user` WHERE `userid` NOT IN (23,24,46) who post this you just repeat my words and this is given above SELECT * FROM `user` WHERE `userid` NOT IN (23,24,46) are you HMMMMMMMMM ????????? Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted August 9, 2007 Share Posted August 9, 2007 no..wat i mean is gingerrobot's code may be used...... heheheheh.... 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.