I need to generate a list of dates with MYSQl between two given dates and also, this list of the dates must to filter the dates that corresponds to Tuesday and Thursday days. Is it possible?
In the meantime, here's a sample that you can use:
-- TO SELECT DATES IN A GIVEN RANGE
-- THAT DO NOT FALL ON A TUESDAY AND THURSDAY
SELECT dateColumn
FROM yourTable
WHERE DAYOFWEEK(dateColumn) NOT IN (3,5)
AND dateColumn BETWEEN '2011-01-01' and '2011-12-31';
If you want the dates enumerated (not from your database) then see this link:
List of dates between two dates
You should be able to adjust the solution to filter for the desired day name using MySQL DayName function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.