查看最近7天入库量(包括当天)
select
substring(col_date,1,10),count(*) from courtbulletin where
SUBDATE(CURDATE(),INTERVAL 6 Day) < col_date group by
substring(col_date,1,10);
col_date: 表中入库时间字段(yyyy-MM-dd HH:mm:SS)
SUBDATE(): 时间计算函数
CURDATE(): 当前时间函数
查看最近7天入库量(包括当天)
select
substring(col_date,1,10),count(*) from courtbulletin where
SUBDATE(CURDATE(),INTERVAL 6 Day) < col_date group by
substring(col_date,1,10);
col_date: 表中入库时间字段(yyyy-MM-dd HH:mm:SS)
SUBDATE(): 时间计算函数
CURDATE(): 当前时间函数