标签:
----昨天 select * from 表 where Time>=datetime(‘now‘,‘start of day‘,‘-1 day‘) and Time<datetime(‘now‘,‘start of day‘,‘+0 day‘) ----当天 select * from 表 where Time>=datetime(‘now‘,‘start of day‘,‘+0 day‘) and Time<datetime(‘now‘,‘start of day‘,‘+1 day‘) ----当周 select * from 表 where Time>=datetime(‘now‘,‘start of day‘,‘-7 day‘,‘weekday 1‘) AND Time<datetime(‘now‘,‘start of day‘,‘+0 day‘,‘weekday 1‘) ----当月 select * from 表 where Time>=datetime(‘now‘,‘start of month‘,‘+0 month‘,‘-0 day‘) AND Time < datetime(‘now‘,‘start of month‘,‘+1 month‘,‘0 day‘) ----上月 select * from 表 where Time>=datetime(‘now‘,‘start of month‘,‘-1 month‘,‘-0 day‘) AND Time <datetime(‘now‘,‘start of month‘,‘+0 month‘,‘-1 day‘)
标签:
原文地址:http://www.cnblogs.com/hougelou/p/4259223.html