1.今天 2.昨天 3.本周 4.上周 5.近7天 6.近30天 7.本月 8.上月 9.近6個月 10.本季度 11.上季度 ...
當天: select from T news where datediff day,addtime,getdate 最近三天: select from T news where datediff day,addtime,getdate lt and datediff day,addtime,getdate gt 本周: select from T news WHERE DATEPART wk, a ...
2016-09-01 09:40 1 9247 推薦指數:
1.今天 2.昨天 3.本周 4.上周 5.近7天 6.近30天 7.本月 8.上月 9.近6個月 10.本季度 11.上季度 ...
1.今天 2.昨天 3.本周 4.上周 5.近7天 6.近30天 7.本月 8.上月 9.近6個月 ...
當天數據:select * from tableName where datediff(day, 字段名,getdate())=0 本周數據:select * from tableName where datediff(week, 字段名,getdate())=0 本月:select ...
1.今天 2.昨天 3.本周 4.上周 5.近7天 6.近30天 7.本月 8.上月 9.近6個月 10.本季度 ...
前提條件:假設表名為:tableName;時間字段名為:theDate ①查詢本周的記錄 select * from tableName where DATEPART(wk, theDate) = DATEPART(wk, GETDATE()) and DATEPART(yy ...
參數聲明 1、查詢本日開始、結束時間 2、查詢本周開始、結束時間 3、查詢本月開始時間、結束時間 4、查詢本季度開始、結束時間 5、查詢本年度開始時間、結束時間 ...
查詢當天的所有數據 SELECT * FROM 表名 WHERE DATEDIFF(字段,NOW())=0 查詢昨天的所有數據 SELECT * FROM 表名 WHERE DATEDIFF(字段,NOW())=-1 查詢未來第n天的所有數據 //當n為負數 ...
數據庫字段是createtime 里面保存的是時間戳 然后再CompanyAction.class.php中寫 $list=$Shop->where($data)->select(); $this->list=$list ...