0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MariaDBで任意の期間のカレンダーを生成する

Last updated at Posted at 2024-02-27

WITH RECURSIVEを使う。

WITH RECURSIVE dates(date) AS (
	SELECT
		'2024-01-01'
	UNION ALL
	SELECT ADDDATE(date,1)
FROM dates WHERE DATE < '2024-01-18' )
SELECT * FROM dates;

結果

2024-01-01
2024-01-02
2024-01-03
2024-01-04
2024-01-05
2024-01-06
2024-01-07
2024-01-08
2024-01-09
2024-01-10
2024-01-11
2024-01-12
2024-01-13
2024-01-14
2024-01-15
2024-01-16
2024-01-17
2024-01-18
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?