aaronpk
aaronpk
Any clever SQL people out there? Given the raw data on the left, (a table of test results) how do I write a SQL query to give me the results on the right, (the results grouped by date as well as grouped by result)?

|
Embed
Progress spinner
johnbrayton
johnbrayton

@aaronpk

select 
    date, 
    sum(case when success = 1 then 1 else 0 end) as success,
    sum(case when success = 1 then 0 else 1 end) as fail
from foo
group by date
order by date desc;
|
Embed
Progress spinner