get last month value in postgres code example
Example 1: postgresql get last day of month
SELECT (date_trunc('month', '2017-01-05'::date) + interval '1 month' - interval '1 day')::date
AS end_of_month;
Example 2: postgres get last value
select last_value("name") over(order by created_at desc) as name from profile