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] 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] 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 Link to comment https://forums.phpfreaks.com/topic/23269-query-syntax/#findComment-105496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.