WinDrop
12-14-2011, 07:45 PM
Hi all, Would like to ask a question, I'm making a query but can't sort out how to write it correctly.
I have a table, and there are two fields, one of them is `country`, other one `active`
My Task is to get all rows that contain:
country LIKE '%United Kingdom%'
or
country LIKE '%ALL%'
AND
active=1
so, for example if country fields will be: United Kingdom, United States, India, France. It should print it.
If country field will be: ALL. It should print it.
Also it should print all rows where country is '%United Kingdom%' OR '%ALL%' AND where active=1
I tried this query:
SELECT * FROM `offers` WHERE `country` LIKE '%Kingdom%' OR `country` LIKE '%ALL%' AND `active`=1
But this query also print all rows where active = 0
So now i'm a bit stuck with this... :(
Please help me with it :)
Thanks.
I have a table, and there are two fields, one of them is `country`, other one `active`
My Task is to get all rows that contain:
country LIKE '%United Kingdom%'
or
country LIKE '%ALL%'
AND
active=1
so, for example if country fields will be: United Kingdom, United States, India, France. It should print it.
If country field will be: ALL. It should print it.
Also it should print all rows where country is '%United Kingdom%' OR '%ALL%' AND where active=1
I tried this query:
SELECT * FROM `offers` WHERE `country` LIKE '%Kingdom%' OR `country` LIKE '%ALL%' AND `active`=1
But this query also print all rows where active = 0
So now i'm a bit stuck with this... :(
Please help me with it :)
Thanks.