Support Questions

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

SQL to Hive Query Conversion

avatar
Explorer

Hi Team,

I have below requirement to convert the SQL server queries into hive. But i am not sure how to achive that as there is no pivot and unpivot available in hive.

could you please help me with the hive equivalent queries for the below SQL queries?

 

Query 1
-----------------

SELECT x,y,z
FROM dbo.tbl1 UNPIVOT (split FOR check IN (1, y2, y3, y4, y5, y6, y7, y8, y9, y10)) AS splnpivot

Query 2
----------------

SELECT *
FROM
(SELECT a,b,c FROM tbl2) SRC
PIVOT (
SUM(TOTAL_AMOUNT) FOR cbn_TYPE IN ([ONE TQ FOUR], [going loss], [COSTS LEAVING team sales], [profit], [check money])) AS PIV;

Query 3
--------------

NULLIF (ISNULL(abc.Tc, 0) + ISNULL(abc.YR, 0), 0);

 

Thanks in advance,

Wasim

 

1 ACCEPTED SOLUTION

avatar
Super Collaborator
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
1 REPLY 1

avatar
Super Collaborator
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login