如何改变空结果? mysql
SELECT 'id' FROM `table` WHERE `id` =
(select min(`id`) FROM `table` where
`id` < 1 and `ids` = 1)
id ids
1 1
2 1
5 1
6 1
结果:
id = ''
我需要将 id=''
更改为 id='n/a'
SELECT 'id' FROM `table` WHERE `id` =
(select min(`id`) FROM `table` where
`id` < 1 and `ids` = 1)
id ids
1 1
2 1
5 1
6 1
Result:
id = ''
I need to change id=''
to id='n/a'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果查询返回空结果,您可以使用 COALESCE,这样:
或者如果返回结果是空字符串,您可以执行以下操作:
If the query return a null result you can use COALESCE so :
OR if the return result is an empty string you can do :
另一种选择是: IFNULL
Another option would be: IFNULL