Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to create hive table with different columns as alias pointing to one column

avatar
Explorer
 
1 REPLY 1

avatar
Super Collaborator

Hi @Dinesh Singh,

If I understand correctly you need to select value which ever has non null out of two columns,

for instance if your data has this manner.

Col1Col2
A1B1
NULLB2
A3NULL

and you would like to select the data as (A1,B2,A3) you may use COALESCE(Col1,Col2,'<Your Default value>')

and on top of this table you may create a view so that end user directly view the result as single columns

NB: If you are convenient you may use case statement for complex logic implementation to retrieve as single column.

Thanks,