Deviopath › PostgreSQL

Every Day, Even the Quiet Ones

Medium · Dates

GROUP BY only produces days that have rows. To show every day in a range, generate the days with generate_series(start, stop, INTERVAL '1 day') and LEFT JOIN the data onto them. With dates it returns timestamps, so cast with ::date.

Return day (a date) and revenue (sum of total of paid orders that day) for every day from 2026-03-01 to 2026-03-07 inclusive. Days without paid orders show 0.00 (use COALESCE(..., 0.00)). Sort by day.

Next: Share of Category Revenue