ok, my question today is that: i want to get data from table according to criteria. if no result i want it to use a given value. my query looks like that :
select distinct COALESCE(table.Name,'a') as name,
'b' as val1,
'c' as val2,
'd' as val3
from table
where table.Id='255';
If there is Id 255 I want the query to return the name with that id. otherwise, I want it to return the value 'a'. other fields should return their values anyway. when I use the above query I get an empty result set because there is no Id = '255' in table.
anyone? thanks a lot