database - Categorize using spark sql -
i want summeraize in following table
how using @ least sql?
edit class3 count should 2. that's typo
this can done in sql below
select org, sum(case when class='class1' 1 else o end) class1count, sum(case when class='class2' 1 else o end) class2count, sum(case when class='class3' 1 else o end) class3count, sum(case when class='class4' 1 else o end) class4count tablename group org 

Comments
Post a Comment