group by date, confirm, pending
im trying to build chart for users for each day with total confirmed user and total pending users for that each day and i need data like following:
date | 开发者_运维百科 confirmed | pending
2010-01-05 | 5 | 2
2010-01-06 | 10 | 3
following is the structure of the table:
user_id
username
confirm enum(0,1)
date date
SELECT Date, SUM(CASE Confirm WHEN 1 THEN 1 ELSE 0 END) Confirmed,
SUM(CASE Confirm WHEN 0 THEN 1 ELSE 0 END) Pending,
FROM Table
GROUP BY Date
精彩评论