Jump to content

Archived

This topic is now archived and is closed to further replies.

jaymc

Query Syntax

Recommended Posts

Ok, basically I want to run 1 query and search for where ID rows = 5 different numbers

So essentially it is going to search the entire table and try pull out 5 different rows based on my search criteria

Is 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 ANDS

maybe something like

[code]WHERE ID = '1,4,7,21,51'[/code]

[b]Any help?[/b]

Share this post


Link to post
Share on other sites
[code]SELECT * FROM artists WHERE ID IN (1,4,7,21,51) LIMIT 0,5[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.