V
V
Vladimir Golub2018-03-11 22:29:29
PostgreSQL
Vladimir Golub, 2018-03-11 22:29:29

How to select by month in postgresql?

There is an application table with many attributes, but it doesn't matter. The main attribute is the creation date.
What is the best way to sample by month? Or is it better to add additional attributes for the month and year of the application?
Sample needed: November - 2 applications, December - 3 applications, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-03-11
@RazerVG

SELECT date_trunc('month', date_created), count(*)
FROM table_name
GROUP BY date_trunc('month', date_created)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question