Home > database >  Novice mysql SQL statements for help, for a great god
Novice mysql SQL statements for help, for a great god

Time:10-25

For the current time push every day 14 days of SQL, thank you

CodePudding user response:

Where date CodePudding user response:

 with recursive t (d, n) as (
The select now (), 1
Union all
The select date_sub (d, 14 day interval), n + 1 from t where n<=10)
Select * from t;

| a n d |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - | -- - |
The 2020-02-13 17:33:51 | 1 |
The 2020-01-30 17:33:51 | 2 |
The 2020-01-16 17:33:51 | 3 |
The 2020-01-02 17:33:51 | | 4
The 2019-12-19 17:33:51 | | 5
The 2019-12-05 17:33:51 6 | |
The 2019-11-21 17:33:51 7 | |
The 2019-11-07 17:33:51 8 | |
The 2019-10-24 17:33:51 | | 9
The 2019-10-10 17:33:51 | | 10
The 2019-09-26 17:33:51 11 | |

  • Related