I have a table record
with the columns:
x
userId
ip
timestamp
userAgent
How do I write a query that will list the site traffic per month (measured in # of logins) from January 2017 through December 2017
Advertisement
Answer
You can use group by
as follows:
select userId, date_trunc('month', timestamp) as Month_, count(*)
From your_table t
Where year(timestamp) = 2017
group by userId, date_trunc('month', timestamp) ;