Home > database >  With the use of the recursive (mysql8.0)
With the use of the recursive (mysql8.0)

Time:10-29

With recursive t (n) as (
Values (1)
Union all
Select the n + 1 from t where n<100)
Select sum (n) from t
How do the above SQL statement to the grammar mistakes? consult

CodePudding user response:

Already know, thank you, should be t into keyword cte

CodePudding user response:

T is just a temporary table the table name is not a keyword, your mistake in the initialization of the first SQL
 with recursive t (n) as (
Select 1
Union all
Select the n + 1 from t where n<100)
Select sum (n) from t

CodePudding user response:

You should see the cte of is official manual take the Table name, is a Common Table Expressions of shorthand, is not a keyword,
  • Related