Page 1 of 1

Sos how to selec multiple roll with more one than where Sos

Posted: Sun Jul 06, 2008 4:27 pm
by shaun112
pleas i how can select multiple colums with the where statement.e.g
select * from tablename where name=$inputname, name=$inputname, name=$inputname,

this is the kind of sturf i want to achieve.pleas help

Re: Sos how to selec multiple roll with more one than where Sos

Posted: Sun Jul 06, 2008 5:05 pm
by califdon
shaun112 wrote:pleas i how can select multiple colums with the where statement.e.g
select * from tablename where name=$inputname, name=$inputname, name=$inputname,

this is the kind of sturf i want to achieve.pleas help
If you want to select rows based on values in different columns, use the AND operator:

Code: Select all

SELECT * FROM tablename WHERE city=$inputcity AND country=$inputcountry AND dateofbirth < '1991-10-04'
But your example was selecting rows based on the value in just one column. For that you can use the OR operator, or you can use IN():

Code: Select all

SELECT * FROM tablename WHERE name=$inputname1 OR name=$inputname2
 
SELECT * FROM tablename WHERE name IN($inputname1, $inputname2, $inputname3)