I'm attempting to use the Date Generation Example to generate my own date range but I can't get the query to run. The query fails and Workbench shows an error indicating my syntax is invalid.
Am I overlooking/misunderstanding something about how this can be used? I can't use stored procedures so I hope this isn't limited to being used in that context.
use mydb; WITH RECURSIVE dates (date) AS ( SELECT date + INTERVAL 1 DAY FROM dates WHERE DAYOFWEEK(date) = 1 AND date >= DATE_SUB(NOW(), INTERVAL 1 YEAR); ) SELECT * FROM dates;