Katakanlah kolom yang berisi tanggal bernama yourDateColumn
dan kolom yang berisi status bernama statusColumn
, Anda dapat melakukan:
SELECT yourDateColumn,
SUM(statusColumn="On") as On,
SUM(statusColumn="Off") as Off
FROM yourTable
GROUP BY yourDateColumn
ORDER BY yourDateColumn