1111

select is_default ,high_quantity, count(*), sum(click) , sum(click)/count(*) 
        ,sum(pay) , sum(pay)/count(*)
from (
    select queryseg_norm_d,item_id,queryseg_norm,if(s_tag in ('1','3','5','7'),'Y','N') is_default
            ,S_th , if(label=1,1,0) click, if(label=4000,1,0) pay 
            ,if(coalesce(S_th,0)>=10000,1,0) high_quantity
    from search_offline.s_c2m_offline_stacking_aop_sample_orc 
    where ds=max_pt('search_offline.s_c2m_offline_stacking_aop_sample_orc')
) ta 
group by is_default ,high_quantity
;
原文地址:https://www.cnblogs.com/sylar120/p/14035238.html