Home > database >  [variable assignment] My Sql by month
[variable assignment] My Sql by month

Time:11-08

Ask: how to per month natural circulation assignment

DECLARE @ the date date, @ n int, int @ k
Select @ date='2019-11-01', @ n=9, @ k=0


The set @ k=@ k + 1
Set @ date=dateadd (mm, 1, @ date)

End


Results: according to the natural cycles @ the date into @ the month month each loop + 1 month
  • Related