Reputation: 2409
I have a table:
EventTime | InTeam | Points | ---------------------------------------- 2014-07-16 11:40 True 10 2014-07-16 10:00 False 20 2014-07-16 09:20 True 30 2014-07-15 11:20 False 5 2014-07-15 10:20 True 10 2014-07-15 09:00 False 10
Is it possible to make a query that results with:
EventDate | InTeam Points | Not In Team Point | ------------------------------------------------- 2014-07-16 40 20 2014-07-15 10 15
Where InTeam Points
is a sum of all team points during the day and Not In Team Point
is a sum of not in team points during the day?
Upvotes: 1
Views: 56
Reputation: 204746
select date(eventtime) as eventtime,
sum(case when inteam = 'true' then points end) as in_team_points,
sum(case when inteam = 'false' then points end) as not_in_team_points
from your_table
group by date(eventtime)
Upvotes: 5