Last active
May 29, 2018 08:01
-
-
Save thanoojgithub/3de1adabca7f91dac704 to your computer and use it in GitHub Desktop.
case when in Hive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hive> set hive.cli.print.header=true; | |
hive> select location,(case when doa is not null then concat(location,',',doa) when doa is null then location end ) as location_doa from thanooj.cust_credit; | |
OK | |
location location_doa | |
ayodhya ayodhya,2015-10-12 | |
midhila midhila,2015-09-12 | |
ayodhya ayodhya,2015-11-12 | |
ayodhya ayodhya,2015-12-12 | |
ayodhya ayodhya,2015-12-12 | |
ayodhya ayodhya,2015-11-12 | |
ayodhya ayodhya,2015-10-12 | |
midhila midhila,2015-09-12 | |
ayodhya ayodhya,2015-11-12 | |
ayodhya ayodhya,2015-12-12 | |
ayodhya ayodhya,2015-12-12 | |
ayodhya ayodhya,2015-11-12 | |
Time taken: 0.094 seconds, Fetched: 12 row(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment