In book_ing A2 column of the table, write every Tuesday the date of the corresponding 2018, every date, in A3 column write the Numbers 1 to 8, respectively, format the following
A2, A3
The 2018-07-31 1
The 2018-07-31 2
The 2018-07-31 3
.
The 2018-08-07 1
The 2018-08-07 2
The 2018-08-07 3
CodePudding user response:
For our great god just assistCodePudding user response:
MySQL result set more arduous, but also can do
- insert into book_ing (a2, a3)
SELECT dt. Date, tc ol
The FROM (
Select @ row:=@ row + 1 as days, DATE_ADD (ymd, INTERVAL @ row DAY) as the date
The from
(select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 union select 10) t1,
(select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 union select 10) t2,
(select 1 union select 2 union select 3 union select 4) t3,
(SELECT @ row:=1, DATE_FORMAT (' 2018-01-01 ', '% % m - Y % d) ymd) r
Dt,
(select 1 col union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8) t
Where DAYOFWEEK (dt. Date)=3 and days<365
The order by the date, col
;