MySQL Forums
Forum List  »  Newbie

Re: Need help Building mysql query to count specific data under same table/row
Posted by: Praveen yadhav
Date: September 29, 2016 12:28AM

I figured it out .. thanks for the help.

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,
count(distinct(case when (event_type = 'Client C Log') then user_id else 0 end)) as Client
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');

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.