Re: SQL query question
Re: SQL query question
От:
Rodrigo De León <rdeleonp@gmail.com>
Дата:
On Sep 21, 12:09 am, stevenleong...@gmail.com wrote: > Write the query (or queries if necessary) needed to count the number > of employees in each employee's department who are paid more than > their manager. SELECT e.dept, COALESCE (SUM (1), 0) AS n FROM employees e JOIN employees m ON (e.empid = m.mgrid AND e.salary > m.salary) GROUP BY e.dept ORDER BY e.dept