Skip to content
Advertisement

How to get first row of data for each month (postgres)

I am a beginner in postgres and would like to get the first row for each month (group by) but I’m not really sure how.

My table order is as per below:

the expected outcome should be as per:

But I was not able to get the above result using the query below where the result I get is the same as the table:

Advertisement

Answer

Close. Use the month and get rid of the group by:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement