1
我有一個按星期對結果進行分組的查詢。但是,幾個星期的總數是0,這會拋棄我的圖表。有沒有可能添加一個0周有0評論?按星期計算的SQL組包括星期數,其中count爲0
SELECT COUNT(*) AS total,
DATE_TRUNC('week', created_at) AS week FROM "reviews"
GROUP BY DATE_TRUNC('week', created_at)
ORDER BY DATE_TRUNC('week', created_at)
感謝,試圖運行,但語法錯誤或接近'FROM(SELECT' ... – user2954587