Count the number of records per week
suggest changeSELECT date_trunc('week', <timestamp_column>) AS "Week", count(*)
FROM <table_name>
GROUP BY 1
ORDER BY 1;
date_trunc('week', ...) returns the Monday of that week (ISO weeks) as a timestamp. The session TimeZone applies when the column is timestamptz.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents