Page 1 of 1

MySQL query

Posted: Wed Dec 28, 2005 1:14 pm
by hanzo

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb'AND activated = '1' ORDER BY `order` ASC";
I have this query but it should also return rows where activated = 2 how do I do that?

Thanks

Posted: Wed Dec 28, 2005 1:16 pm
by hawleyjr

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb' AND (activated = '1'  or activated = '2') ORDER BY `order` ASC";

Posted: Wed Dec 28, 2005 1:17 pm
by hanzo
thanks 8)

Posted: Thu Dec 29, 2005 8:50 am
by dreamline
A little bit shorter would be:

Code: Select all

$query = "SELECT `name` FROM `users` WHERE product = 'ipod video 60gb' AND activated in ('1','2') ORDER BY `order` ASC";
Just my 2 cents.. :)