We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PageHelper.startPage(1, 10); xxMapper.select(model);
WITH cte (id, parent_id, level) AS ( SELECT id, parent_id, 0 FROM users WHERE parent_id IS NULL -- 根节点条件 UNION ALL SELECT t.id, t.parent_id, cte.level + 1 FROM users t, cte WHERE cte.id = t.parent_id AND cte.LEVEL<10 ) SELECT id, parent_id, level FROM cte
以上sql在count() 阶段不会报错,但是分页的时候会报错,希望优化成以下sql
WITH cte (id, parent_id, level) AS ( SELECT id, parent_id, 0 FROM users WHERE parent_id IS NULL -- 根节点条件 UNION ALL SELECT t.id, t.parent_id, cte.level + 1 FROM users t, cte WHERE cte.id = t.parent_id AND cte.LEVEL<10 ) SELECT id, parent_id, level FROM cte OFFSET 20 ROWS FETCH FIRST 10 ROWS ONLY
The text was updated successfully, but these errors were encountered:
报什么错?
Sorry, something went wrong.
No branches or pull requests
使用环境
SQL 解析错误
分页参数
原 SQL
以上sql在count() 阶段不会报错,但是分页的时候会报错,希望优化成以下sql
The text was updated successfully, but these errors were encountered: