select * from wap_content where week(created_at) = week(now)
創(chuàng)新互聯(lián)是一家專業(yè)提供黃石港企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)制作、網(wǎng)站制作、H5高端網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為黃石港眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
如果你要嚴(yán)格要求是某一年的,那可以這樣
查詢一天:
select * from table where to_days(column_time) = to_days(now());
select * from table where date(column_time) = curdate();
查詢一周:
select * from table where DATE_SUB(CURDATE(), INTERVAL 7 DAY) = date(column_time);
查詢一個(gè)月:
select * from table where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) = date(column_time);
mysql中怎么查詢一周內(nèi),三個(gè)月內(nèi)\x0d\x0a使用sql語句查詢?nèi)掌谠谝恢軆?nèi)的數(shù)據(jù)\x0d\x0aselect * from ShopOrder where datediff(week,ordTime,getdate()-1)=0 //查詢當(dāng)天日期在一周年的數(shù)據(jù)\x0d\x0aselect * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 //查詢當(dāng)天的所有數(shù)據(jù)\x0d\x0a SELECT * FROM A where datediff(d,datetime,getdate())
回答于?2022-12-11
查詢當(dāng)前這周的數(shù)據(jù)
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,'%Y-%m-%d')) = YEARWEEK(now());
查詢上周的數(shù)據(jù)
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,'%Y-%m-%d')) = YEARWEEK(now())-1;
查詢當(dāng)前月份的數(shù)據(jù)
select name,submittime from enterprise where date_format(submittime,'%Y-%m')=date_format(now(),'%Y-%m')
網(wǎng)頁名稱:mysql怎么對一周數(shù)據(jù) mysql查詢一周內(nèi)的記錄
文章URL:http://bm7419.com/article44/ddcsihe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、企業(yè)網(wǎng)站制作、虛擬主機(jī)、微信小程序、做網(wǎng)站、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)