在服务器上出错并在本地主机上正常工作,Laravel CTE(邻接)
Getting error at server and working fine at localhost, Laravel CTE (Adjacency)
我在服务器上遇到以下错误,但在本地主机上工作正常。我正在使用 laravel 邻接表 https://github.com/staudenmeir/laravel-adjacency-list:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'recursive `laravel_cte` as ((select *, 1 as `depth`, cast(`id` as char(65535)) a' at line 1 (SQL: with recursive `laravel_cte` as ((select *, 1 as `depth`, cast(`id` as char(65535)) as `path` from `user_relations` where `user_relations`.`parent_id` = 10000 and `user_relations`.`parent_id` is not null) union all (select `user_relations`.*, `depth` + 1 as `depth`, concat(`path`, '.', `user_relations`.`id`) from `user_relations` inner join `laravel_cte` on `laravel_cte`.`id` = `user_relations`.`parent_id`)) select count(`id`) as aggregate from `laravel_cte` where `status` = 0)
请帮助我解决它,我是新手,因为我对这种复杂的mySQL/MariaDB开发一窍不通。
"CTE" (WITH RECURSIVE ...
) 在 MariaDB 10.2 或 MySQL 8.0 之前不可用。
我在服务器上遇到以下错误,但在本地主机上工作正常。我正在使用 laravel 邻接表 https://github.com/staudenmeir/laravel-adjacency-list:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'recursive `laravel_cte` as ((select *, 1 as `depth`, cast(`id` as char(65535)) a' at line 1 (SQL: with recursive `laravel_cte` as ((select *, 1 as `depth`, cast(`id` as char(65535)) as `path` from `user_relations` where `user_relations`.`parent_id` = 10000 and `user_relations`.`parent_id` is not null) union all (select `user_relations`.*, `depth` + 1 as `depth`, concat(`path`, '.', `user_relations`.`id`) from `user_relations` inner join `laravel_cte` on `laravel_cte`.`id` = `user_relations`.`parent_id`)) select count(`id`) as aggregate from `laravel_cte` where `status` = 0)
请帮助我解决它,我是新手,因为我对这种复杂的mySQL/MariaDB开发一窍不通。
"CTE" (WITH RECURSIVE ...
) 在 MariaDB 10.2 或 MySQL 8.0 之前不可用。