[
https://issues.apache.org/jira/browse/MADLIB-908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15313414#comment-15313414
]
Rahul Iyer edited comment on MADLIB-908 at 6/3/16 12:48 AM:
------------------------------------------------------------
Actually we can combine the two
{code}
SELECT id,
sum(CASE WHEN piv = 10 THEN val ELSE 0 END) as "piv_10" ,
sum(CASE WHEN piv = 20 THEN val ELSE 0 END) as "piv_20" ,
sum(CASE WHEN piv = 30 THEN val ELSE 0 END) as "piv_30"
FROM
pivset
GROUP BY id;
{code}
That would prevent the multiple group by columns.
was (Author: riyer):
Actually we can combine the two: do a
{code}
SELECT id,
sum(CASE WHEN piv = 10 THEN val ELSE 0 END) as "piv_10" ,
sum(CASE WHEN piv = 20 THEN val ELSE 0 END) as "piv_20" ,
sum(CASE WHEN piv = 30 THEN val ELSE 0 END) as "piv_30"
FROM
pivset
GROUP BY id;
{code}
That would prevent the multiple group by columns.
> Pivoting
> --------
>
> Key: MADLIB-908
> URL: https://issues.apache.org/jira/browse/MADLIB-908
> Project: Apache MADlib
> Issue Type: New Feature
> Components: Module: Utilities
> Reporter: Frank McQuillan
> Fix For: v1.9.1
>
>
> Story
> As a data scientist, I want to perform pivoting operations on my data, so
> that I can prepare it for input to predictive analytics algorithms.
> Detailed requirements TBD.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)