W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
select date from (
SELECT DATE_FORMAT(DATE_SUB(last_day(curdate()), INTERVAL xc-1 day), '%Y-%m-%d') as date
FROM (
SELECT @xi:=@xi+1 as xc from
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) xc1,
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) xc2,
(SELECT @xi:=0) xc0
) xcxc) x0 where x0.date >= (select date_add(curdate(),interval-day(curdate())+1 day));
輸出結(jié)果:
"date"
"2022-02-28"
"2022-02-27"
"2022-02-26"
"2022-02-25"
"2022-02-24"
"2022-02-23"
"2022-02-22"
"2022-02-21"
"2022-02-20"
"2022-02-19"
"2022-02-18"
"2022-02-17"
"2022-02-16"
"2022-02-15"
"2022-02-14"
"2022-02-13"
"2022-02-12"
"2022-02-11"
"2022-02-10"
"2022-02-09"
"2022-02-08"
"2022-02-07"
"2022-02-06"
"2022-02-05"
"2022-02-04"
"2022-02-03"
"2022-02-02"
"2022-02-01"
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: