sql - CASE: WHEN column1 IS NULL THEN write column2 -
is possible show data column if checked column null?
for example:
- columns:
color
,originalcolor
table:
tablecolors
[color, originalcolor]
[w, b] [ , g] [b, y]
and
select case when color null "extract data originalcolor" tablecolors
should following list: w, g, b
could looking coalesce
? function return first non-null
value.
select coalesce(`color`, `originalcolor`) `color` `tablecolors`;
Comments
Post a Comment