I have a cube like this :
dimensions : source_type, source_id, name, dt
measures:count(distinct uid), count(1) , count(distinct buyer)

I run the query :

select source_type, source_id, name,
    count(distinct uid), count(uid) as cnum, count(distinct buyer) as
buyerNum,
    count(buyer) as bnum
from
    table_name
where
    dt between '2017-06-01' and '2017-09-18'
    and source_id is not null
    and source_type is not null
group by
    source_type, source_id, name
order by buyerNum desc limit 1 offset 0

return :

mv
423031
起点‧终站
193794
92
42043
92





obviously, it is error result, I query the sourceid like this:

select source_type, source_id, name,
    count(distinct uid), count(uid) as cnum, count(distinct buyer) as
buyerNum,
    count(buyer) as bnum
from
    vip_buying_funnel_cube_view
where
    dt between '2017-06-01' and '2017-09-18'
    and source_id is not null
    and source_type is not null
    and source_id = '423031'
group by
    source_type, source_id, name
order by buyerNum desc limit 1 offset 0

the result is corrent :

mv
423031
起点‧终站
77
92
11
92

Reply via email to