kylin-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ShaoFeng Shi <>
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

2017-10-31 11:48 GMT+08:00 <>:

> 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~
> ------------------------------

Best regards,

Shaofeng Shi 史少锋

View raw message