Count the number of records per week

suggest change
SELECT 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents