Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 295 Bytes

File metadata and controls

12 lines (10 loc) · 295 Bytes

Registered users in the current year

SELECT
  TO_CHAR(created_at, 'Month') AS month,
  COUNT(*) AS registered_users
FROM users
WHERE EXTRACT(YEAR FROM created_at) = EXTRACT(YEAR FROM CURRENT_TIMESTAMP)
GROUP BY TO_CHAR(created_at, 'Month')
ORDER BY TO_CHAR(created_at, 'Month') ASC;