select
count(*) as allBookCount,
count(*) filter(where createtime between (SELECT current_date - interval '30 day') and current_date ) as
last30DAddBookCount ,
count(*) filter(where createtime between (SELECT current_date - interval '7 day') and current_date) as
last7DAddBookCount ,
count(*) filter(where createtime between (SELECT current_date - interval '1 day') and current_date) as
yesterdayAddBookCount ,
count(*) filter(where createtime >=current_date ) as todayAddBookCount
from t_e_book
PGSQL获取过去30天,7天,昨天,今天的数据
最新推荐文章于 2024-06-04 11:38:19 发布