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?
hive> select mid, tag1, tag2, dt from message_use_tags where dt="20211107" and (tag1 != '' or tag2 != 'NULL') and (tag1 != '' and tag2 != '') limit 50;