Support Questions
Find answers, ask questions, and share your expertise

SQL to Hive Query Conversion

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

 

0 REPLIES 0
; ;