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)?
4
1
4
something like this or similar (untested)?: SELECT `date`, SUM(IF(success, 1, 0)) AS `success`, SUM(IF(success, 0, 1)) AS `fail` FROM t GROUP BY `date`
1
1
you win! That's brilliant, I didn't even think about using an `IF`!
1
1
😎 did you try it already? it was off the top of my head …
1
Replying to @jkphl
Yep it worked perfectly!

Sep 16, 2022 · 4:01 PM UTC

1