table t;
ребят как сортировать по дате?
order by 1
SELECT to_char(t.created_date, 'YYYY-MM-dd') m, COUNT(t.id) total FROM table t GROUP BY 1 ORDER BY t.created_date;
[42803] ERROR: column "t.created_date" must appear in the GROUP BY clause or be used in an aggregate function
SELECT to_char(t.created_date::date, 'YYYY-MM-dd') m, COUNT(t.id) total FROM table t GROUP BY t.created_date::date ORDER BY t.created_date::date;
или SELECT to_char(oiu.created_date, 'YYYY-MM-dd') m, COUNT(oiu.id) total FROM one_id_user oiu GROUP BY 1 ORDER BY 1 desc
Обсуждают сегодня