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
SELECT e1.employee_name, e1.salary FROM employees e1 <----------------------------┐ WHERE e1.salary > ( | SELECT AVG(e2.salary) | FROM employees e2 | WHERE e2.dept_id = e1.dept_id | AND e2.salary > ( | SELECT AVG(e3.salary) | FROM employees e3 | WHERE e3.dept_id = e1.dept_id --------┘ ) );
Query execution fails for correlated subqueries with a depth exceeding 1, generation error as follows:
Schema error: No field named e1.dept_id. Did you mean 'e3.dept_id'?.
CREATE TABLE employees ( employee_id INTEGER, employee_name VARCHAR, dept_id INTEGER, salary DECIMAL ); CREATE TABLE project_assignments ( project_id INTEGER, employee_id INTEGER, priority INTEGER ); SELECT e1.employee_name, e1.salary FROM employees e1 WHERE e1.salary > ( SELECT AVG(e2.salary) FROM employees e2 WHERE e2.dept_id = e1.dept_id ); SELECT e1.employee_name, e1.salary FROM employees e1 WHERE e1.salary > ( SELECT AVG(e2.salary) FROM employees e2 WHERE e2.dept_id = e1.dept_id AND e2.salary > ( SELECT AVG(e3.salary) FROM employees e3 WHERE e3.dept_id = e1.dept_id ) );
duckdb can run it well:
D SELECT e1.employee_name, e1.salary FROM employees e1 WHERE e1.salary > ( SELECT AVG(e2.salary) FROM employees e2 WHERE e2.dept_id = e1.dept_id AND e2.salary > ( SELECT AVG(e3.salary) FROM employees e3 WHERE e3.dept_id = e1.dept_id ) ); ┌───────────────┬───────────────┐ │ employee_name │ salary │ │ varchar │ decimal(18,3) │ ├───────────────┴───────────────┤ │ 0 rows │ └───────────────────────────────┘
No response
The text was updated successfully, but these errors were encountered:
take
Sorry, something went wrong.
irenjj
No branches or pull requests
Describe the bug
Query execution fails for correlated subqueries with a depth exceeding 1, generation error as follows:
To Reproduce
Expected behavior
duckdb can run it well:
Additional context
No response
The text was updated successfully, but these errors were encountered: