Re: [firebird-support] Why this SQL is correct?

2019-10-14 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
14.10.2019 11:47, ma_go...@yahoo.com [firebird-support] wrote: > In the subselect p.proj_id should not be accepted - group does not contains > it, and has no > aggregate on it. What value the engine choose when it runs, and why? Current one. The subquery is executed for each record of master

[firebird-support] Why this SQL is correct?

2019-10-14 Thread ma_go...@yahoo.com [firebird-support]
Hi! SELECT e.emp_no FROM employee e JOIN employee_project p ON p.emp_no = e.emp_no GROUP BY e.emp_no HAVING MAX((SELECT SUM(e2.salary) FROM employee e2 JOIN employee_project p2 ON p2.emp_no = e2.emp_no WHERE