我正在尝试使用PostgreSQL提取每日数据。我的问题是这一天似乎重置了#39;下午5点左右(洛杉矶时间)。这个问题有解决方法吗?这是我的疑问:
SELECT COUNT(distinct be.booking_id)AS "Number of Bookings Today"
FROM booking_events be
WHERE be.event IN ('approve') AND
be.created_at >= current_date AND
be.created_at < current_date + interval '1 day';
答案 0 :(得分:0)
您可以使用小时数来抵消当前日期。我认为逻辑是:
SELECT COUNT(distinct be.booking_id) as "Number of Bookings Today"
FROM booking_events be
WHERE be.event IN ('approve') AND
be.created_at >= current_date - interval '7 hour' AND
be.created_at < current_date + interval '1 day' - interval '7 hour';