Answer the question
In order to leave comments, you need to log in
How to get a list of dates in MySQL?
Good afternoon!
It is required to get a list of several recent dates, starting from today. Is it possible in MySQL (Version 5.7) to do this in a nicer way than the one below?
SELECT date(now()) as 'date'
union all
SELECT date(SUBDATE(now(), 1)) as 'date'
union all
SELECT date(SUBDATE(now(), 2)) as 'date'
union all
SELECT date(SUBDATE(now(), 3)) as 'date'
union all
SELECT date(SUBDATE(now(), 4)) as 'date';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question