sql - MySql results that were not found, how to get result without a match? -
i running query this:
select x table c in ('variable','test','ok')
i results matching c. (variable , test) because ok doesn't exist in c don't anything. not null or 0 result.
how can mysql want result if doesn't find match term in in condition?
example:
result x = 12 x = 25 x = not found
thanks in advance
i'm not sure if understand problem, guess mean want x column value if c in ('variable','test','ok')
, , if not, want 'not found'
? move in
condition where
clause select
list:
select case when c in ('variable','test','ok') x else 'not found' end table
or, perhaps mean if no rows @ returned, want 1 single 'not found'
row? union all
row.
select x table c in ('variable','test','ok') union select 'not found' (select count(*) cnt table c in ('variable','test','ok') t cnt = 0
Comments
Post a Comment