kylin-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ShaoFeng Shi <shaofeng...@apache.org>
Subject Re: how to write count(if logic) or sum(if logic) sqls?
Date Tue, 31 Oct 2017 07:25:54 GMT
Hi Liubo,

As a workaround, you can create a new Hive view, on which coverting this
"case when" to a new column, and then define a cube over this view.

For example:

create view v_abc as select c1, c2, ... (case when final_money >=5 then 1
else 0 end ) as cn from t_abc;

In the cube, define a measure "SUM(CN)". When Cube is build, run query
"select sum(cn) from v_abc".

For more practices, you can refer to some articles like
http://blog.csdn.net/yu616568/article/details/50548967

2017-10-31 11:48 GMT+08:00 liubo@fcyun.com <liubo@fcyun.com>:

> Hi all,
> Here's my requirement: I need count the number of  deals  which  it's
> deal_money greater than 5.00.          Any ideals, thanks very much~
>
>
>
> ------------------------------
> liubo@fcyun.com
>



-- 
Best regards,

Shaofeng Shi 史少锋

Mime
View raw message