1. 程式人生 > >MySQL查詢本週、上週、本月、上個月份資料的sql指令碼

MySQL查詢本週、上週、本月、上個月份資料的sql指令碼

select * from user where WEEKOFYEAR(FROM_UNIXTIME(pudate,'%y-%m-%d')) = WEEKOFYEAR(now()) select * from user where MONTH(FROM_UNIXTIME(pudate,'%y-%m-%d')) = MONTH(now()) select * from [user] where YEAR(FROM_UNIXTIME(pudate,'%y-%m-%d')) = YEAR(now()) and MONTH(FROM_UNIXTIME(pudate,'%y-%m-%d'
)) = MONTH(now()) select * from [user] where pudate between 上月最後一天 and 下月第一天