jaymc Posted October 7, 2006 Share Posted October 7, 2006 Ok, basically I want to run 1 query and search for where ID rows = 5 different numbersSo essentially it is going to search the entire table and try pull out 5 different rows based on my search criteriaIs this the syntax for that[code]SELECT * FROM `artists` WHERE `ID` = '1'AND `ID` = '4'AND `ID` = '7'AND `ID` = '21'AND `ID` = '51'LIMIT 0,5[/code]I just thought their may be another way rather than using all those ANDSmaybe something like[code]WHERE ID = '1,4,7,21,51'[/code][b]Any help?[/b] Quote Link to comment https://forums.phpfreaks.com/topic/23269-query-syntax/ Share on other sites More sharing options...
AndyB Posted October 7, 2006 Share Posted October 7, 2006 [code]SELECT * FROM artists WHERE ID IN (1,4,7,21,51) LIMIT 0,5[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23269-query-syntax/#findComment-105477 Share on other sites More sharing options...
jaymc Posted October 7, 2006 Author Share Posted October 7, 2006 Worked Quote Link to comment https://forums.phpfreaks.com/topic/23269-query-syntax/#findComment-105496 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.