Page 1 of 1

question re: multiple where values

Posted: Wed Dec 01, 2004 12:37 pm
by voltrader
I would like to select a name field based on a PK field (ref).

I'm using this statement:

Code: Select all

$mysql="SELECT name FROM $detail WHERE ref='29, 30, 2, 4, 25'";
The intent is to get multiple names from the records with those ref numbers, but the statement seems to only pick up the name with ref=29.

Posted: Wed Dec 01, 2004 1:48 pm
by voltrader
Figured it out... needed an 'IN'

Code: Select all

$mysql="SELECT name FROM $detail WHERE ref IN '29, 30, 2, 4, 25'";