--- source: prql/tests/integration/examples.rs expression: sql input_file: prql/tests/integration/examples/employees-0.prql --- WITH table_0 AS ( SELECT emp_no, AVG(salary) AS emp_salary FROM salaries GROUP BY emp_no ), table_1 AS ( SELECT dept_emp.dept_no, t.title, AVG(emp_salary) AS avg_salary FROM table_0 JOIN titles AS t USING(emp_no) LEFT JOIN dept_emp USING(emp_no) GROUP BY dept_emp.dept_no, t.title ) SELECT dept_name, title, avg_salary FROM table_1 JOIN departments USING(dept_no)