'How to find out count month vise in particular day range sql?

Like

date count users
2 jan - 7 feb
2 feb - 7 march


Solution 1:[1]

If you want to group by month with the month including anything from the 3rd of one month until the 2nd of the following month you can use:

GROUP BY date_part('month', event_date - interval '2 day');

If your month runs from the 2nd of one month to the 7th of the following all events between the 2nd and the 7th will be counted twice.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1