WITH position unexpected position using Mysql 8.0 Date Generation 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 &gt;= DATE_SUB(NOW(), INTERVAL 1 YEAR);
)
SELECT * FROM dates;
Recursive CTE implemented in the MySQL 8+ requires the next syntax:

WITH RECURSIVE tbl (a,b,c) AS 
(
  SELECT ...  -- initial portion of rows
  UNION ALL
  SELECT ...  -- recursively added rows
)
SELECT * 
  FROM tbl
   ...
;


Refer to the documentation/primers for the proper recursive CTE using.