求sql语句中带有条件的查询
答案:1 悬赏:80 手机版
解决时间 2021-02-15 18:10
- 提问者网友:最爱你的唇
- 2021-02-15 05:01
求sql语句中带有条件的查询
最佳答案
- 五星知识达人网友:雪起风沙痕
- 2021-02-15 06:38
通用写法
SELECt uid,
uname,
address,
(CASE
WHEN phone1 IS NOT NULL THEN phone1
WHEN phone2 IS NOT NULL THEN phone2
ELSE phone3
END) iphone
FROM users;oracle还可以这么写
SELECt uid,
uname,
address,
(NVL(phone1,NVL(phone2,phone3))) iphone
FROM users;
SELECt uid,
uname,
address,
(CASE
WHEN phone1 IS NOT NULL THEN phone1
WHEN phone2 IS NOT NULL THEN phone2
ELSE phone3
END) iphone
FROM users;oracle还可以这么写
SELECt uid,
uname,
address,
(NVL(phone1,NVL(phone2,phone3))) iphone
FROM users;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯