select * from 表名 where to_days(時間欄位名) = to_days(now());
select * from 表名 where to_days( now( ) ) - to_days( 時間欄位名) <= 1
select * from 表名 where date_sub(curdate(), interval 7 day) <= date(時間欄位名)
select * from 表名 where date_sub(curdate(), interval 30 day) <= date(時間欄位名)
select * from 表名 where date_format( 時間欄位名, 『%y%m』 ) = date_format( curdate( ) , 『%y%m』 )
select * from 表名 where period_diff( date_format( now( ) , 『%y%m』 ) , date_format( 時間欄位名, 『%y%m』 ) ) =1
select * fromht_invoice_information
where quarter(create_date)=quarter(now());
select * fromht_invoice_information
where quarter(create_date)=quarter(date_sub(now(),interval 1 quarter));
select * fromht_invoice_information
where year(create_date)=year(now());
select * fromht_invoice_information
where year(create_date)=year(date_sub(now(),interval 1 year));
select name,submittime from enterprise where yearweek(date_format(submittime,』%y-%m-%d』)) = yearweek(now());
select name,submittime from enterprise where yearweek(date_format(submittime,』%y-%m-%d』)) = yearweek(now())-1;
select name,submittime from enterprise where date_format(submittime,』%y-%m』)=date_format(now(),』%y-%m』)
select name,submittime from enterprise where submittime between date_sub(now(),interval 6 month) and now();
select name,submittime from enterprise where date_format(submittime,』%y-%m』)=date_format(date_sub(curdate(), interval 1 month),』%y-%m』)
select * fromuser
where date_format(pudate, 』 %y%m 』 ) = date_format(curdate(), 』 %y%m 』 ) ;
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 下月第一天
where date(regdate) = curdate();
select * from test where year(regdate)=year(now()) and month(regdate)=month(now()) and day(regdate)=day(now())
select date( c_instime ) ,curdate( )
fromt_score
where 1
limit 0 , 30
MySQL關於根據日期查詢資料的sql語句
查詢往前7天的資料 select from 資料表 where date sub curdate interval 7 day 你要判斷的時間欄位名 查詢往前30天的資料 select from 資料表 where date sub curdate interval 30 day 你要判斷的時間欄位...
MySQL關於根據日期查詢資料的sql語句
查詢在某段日期之間的資料 select from 資料表 where 時間欄位名 between 2016 02 01 and 2016 02 05 查詢往前3個月的資料 select from 資料表 where 時間欄位名 between date sub now interval 3 mont...
MySQL關於根據日期查詢資料的sql語句
mysql關於根據日期查詢資料的sql語句 查詢在某段日期之間的資料 select from 資料表 where 時間欄位名 between 2016 02 01 and 2016 02 05 查詢往前3個月的資料 select from 資料表 where 時間欄位名 between date s...