Skip to content

Instantly share code, notes, and snippets.

@rdlabo
Created July 7, 2017 06:26
Show Gist options
  • Save rdlabo/6a939c9b20e12008fa481e28d930bbb2 to your computer and use it in GitHub Desktop.
Save rdlabo/6a939c9b20e12008fa481e28d930bbb2 to your computer and use it in GitHub Desktop.
過去365日の日付をカルムで表示(サブクエリ等にお使い下さい)
SELECT
DATE_FORMAT(DATE_ADD(NOW(), INTERVAL @i := @i - 1 DAY),'%Y-%m-%d') create_date
FROM `information_schema`.COLUMNS,(SELECT @i:=0) s
LIMIT 365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment