查询返回列的空值,需要用值替换空值。我不知道怎么办。请帮忙
SELECT COL1, DATE_END
FROM TABLE1
WHERE COL1 IN('1','2','3','4','5','6','7','8','9','10','11','12')
ORDER BY 1;
是查询。执行时它给出了我,
COL1 DATE_END
1
2
3
4
5
6
7
8
9
10
11
12
因为在表中记录 1...12 的 date_end 为 null
方式修改查询
COL1 DATE_END
1 12/31/9999
2 12/31/9999
3 12/31/9999
4 12/31/9999
5 12/31/9999
6 12/31/9999
7 12/31/9999
8 12/31/9999
9 12/31/9999
10 12/31/9999
11 12/31/9999
12 12/31/9999
,并且应该以输出为
的 我希望这次我很清楚我在尝试什么
请专家帮助我...提前感谢
我使用了“----”,因为我不知道如何在 HTML 中插入空格
SELECT COL1, DATE_END
FROM TABLE1
WHERE COL1 IN('1','2','3','4','5','6','7','8','9','10','11','12')
ORDER BY 1;
is the query. and when executed it gives me
COL1 DATE_END
1
2
3
4
5
6
7
8
9
10
11
12
because in the table the records 1...12 have their date_end as null
and the query should be modified in a way that the output is
COL1 DATE_END
1 12/31/9999
2 12/31/9999
3 12/31/9999
4 12/31/9999
5 12/31/9999
6 12/31/9999
7 12/31/9999
8 12/31/9999
9 12/31/9999
10 12/31/9999
11 12/31/9999
12 12/31/9999
I hope I am clear this time, as to what I was trying out
Please help me experts... Thanks in advance
I have used "----" as I did not know how to insert spaces in HTML
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 COALESCE 函数替换 NULL 值。我也不喜欢在 ORDER BY 子句中使用序数位置,因此我也更改了它。
Use the COALESCE function to replace the NULL values. I'm also not a big fan of using ordinal positions in the ORDER BY clause, so I changed that as well.