请求一条sql语句
如果A字段为空,就取B字段的值,如果B字段的值为空,就取c字段的值,如果c字段的值为空,就取d字段的值字段
A B C D
1 - - -
- 2 - -
- - 3 -
- - - 4
1 2 - -
1 2 3 -
结果;
1
2
3
4
1
1 select coalesce(a,b,c,d) from dual;
COALESCE returns the first non-null expr in the expression list. At least one expr must not be the literal NULL. If all occurrences of expr evaluate to null, then the function returns null.
页:
[1]