أحاول الحصول على عدد تسجيلات المستخدمين حسب اليوم لهذا الشهر، ووقعت في مشكلة عند محاولة التجميع حسب حقل created_at لأنه يتضمن الطابع الزمني. هل يعرف أحد كيفية التجميع حسب التاريخ فقط؟
select count(*), created_at
from users
where created_at > '2018-07-01'
and admin = false
group by created_at
order by created_at desc
@John_Waltrip1, here’s the query I think you’re looking for. I switched to DAY, which is the day of the month, which seems easier for most humans that I know to understand than the day of the year (DOY).
select count(*),
EXTRACT(DAY FROM created_at) as day
from users
where created_at > LOCALTIMESTAMP - INTERVAL '14 days'
and admin = false
group by day
order by day desc