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.... Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/ 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) Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/#findComment-318611 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 Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/#findComment-319027 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) Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/#findComment-319048 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 ????????? Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/#findComment-319077 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.... Link to comment https://forums.phpfreaks.com/topic/63909-solved-help-with-query/#findComment-319095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.