Pivot/Transpose Technique in Hive



Input Data Sample:


nameSex
FurqanM
MdM
NaziaF
PerweenF

Output:

MF
22

Solution:

Select  m, f from 
(select count(case when sex='M' then 1 end) as m,
count(case when sex = 'F' then 1 end) as f from gender
)t ;


No comments:

Post a Comment

Pages