Need help in building MYSQL query to count two content from single row/table

前端 未结 3 473
独厮守ぢ
独厮守ぢ 2021-01-16 18:49

I\'m trying to get count of two set of data which is listed under same table name, with specific date range.

Table \'Event\'

u_id event  Create
123  F_lo         


        
3条回答
  •  长情又很酷
    2021-01-16 19:13

    select to_char(cast(created as date),'YYYY-MM-DD') as Report_date, count(distinct(case when event_type in ('Flash C Log') then user_id else 0 end)) as Flash_Log, count(distinct(case when (event_type = 'Client C Log') then user_id else 0 end)) as Client_Log from events e where created between '25-SEP-16' and '27-SEP-16' group by to_char(cast(created as date),'YYYY-MM-DD') order by to_char(cast(created as date),'YYYY-MM-DD');

提交回复
热议问题