​can you use two separate SQLs to accomplish this?
​

On Wed, Jun 17, 2015 at 4:51 PM, Vineet Mishra <[email protected]>
wrote:

> Hi All,
>
> I am in middle of the requirement where I need to aggregate all the records
> for ALL after group by, so it will be kind of ROLLUP operation where there
> will be additional/one more row with addition of all the columns as
> aggregated.
>
> So for example, I am currently getting the records as
>
> fm,to,obtd
> vs,1,5
> o,2,6
> d,3,7
> fv,4,8
>
> on my query,
>
> SELECT
> ft.fm
> ,count(1) as to
> ,SUM(ft.lmtdf) as obtd
> FROM STAGE.fsc as ft
> where ft.sodp IS NOT NULL
> group by ft.fm
>
> where as what I am looking for is,
>
> fm,to,obtd
> vs,1,5
> o,2,6
> d,3,7
> fv,4,8
> ALL,10,26
>
> So here ALL will be sum of all the records which is basically the ROLLUP
> operation.
>
> Urgent Call! Any quick help would be highly appreciated.
>
> Thanks!
>



-- 
Regards,

*Bin Mahone | 马洪宾*
Apache Kylin: http://kylin.io
Github: https://github.com/binmahone

Reply via email to