Hi all
My db structure is (table r)
id,a,b,c
1,1,1,USA
2,1,2,national
3,1,3,USA
I a m looking for a query which satisfy a=1 and c=usa.If ‘USA’ is not avilable I need to get second row (national).How can I do this in mysql ? and If USA is avilable I need only first and third row.
Is it poosible to get in a single query,please help
I tried this but not getting exact results
select * from r where a = 1 and
(
CASE
WHEN (c = 'USA')
THEN
c= 'USA
ELSE c = 'national'
END
)