我希望从当前日期开始接下来的30天记录。 任何建议或提示将不胜感激。
SELECT end_date FROM master_data
WHERE end_date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) AND CURRENT_DATE();
答案 0 :(得分:3)
您需要DATE_SUB
而不是SELECT end_date
FROM master_data
WHERE end_date BETWEEN CURRENT_DATE()
AND DATE_ADD(CURRENT_DATE(), INTERVAL 30 DAY) ;
,因为接下来的30天将介于当前日期和当前日期+30之间:
Nicholass-MacBook-Air-2:RenameXtalTest nick$ ls
RM01_03_000_0213_Proj1_Clon1_RC_0000RC000870_010_171222_01_03_02_E0_00_031_001_RAI.jpg
RM01_03_000_0213_Proj1_Clon1_RC_0000RC000870_010_171222_07_07_01_E0_99_031_001_RAI.jpg
rename.py