如何选择两个列值之一不能为空的行?
例如:
hive> select mid, tag1, tag2, dt from message_use_tags where dt="20211107" and (tag1 != '' or tag2 != 'NULL') limit 50;
我想指定:
date = '20211107'
tag1 和 tag2 不能同时为空字符串。其中之一可以为空。然而,以下并没有达到目的:
tag1 != '' 或 tag2 != 'NULL'
在结果集中,存在 tag1 和 tag 均为空字符串的行。如何修改语句才能得到想要的结果?
For example:
hive> select mid, tag1, tag2, dt from message_use_tags where dt="20211107" and (tag1 != '' or tag2 != 'NULL') limit 50;
I want to specify:
date = '20211107'
tag1 and tag2 can't be both empty string at the same time. One of them can be empty. However, the following doesn't achieve the purpose:
tag1 != '' or tag2 != 'NULL'
In the result set, there are rows where both tag1 and tags are empty strings. How to modify the statement to get the results desired?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)