Advertisement
apl-mhd

table inside table

Aug 2nd, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.25 KB | None | 0 0
  1. SELECT x.DEPARTMENT_ID, e1.FIRST_NAME, x.mn, x.mx
  2. FROM ( SELECT e2.DEPARTMENT_ID, MAX(e2.SALARY) AS mn, MIN(e2.SALARY) as mx
  3.       FROM employees e2 GROUP BY e2.DEPARTMENT_ID ) as x
  4.       JOIN employees e1 ON e1.DEPARTMENT_ID = x.DEPARTMENT_ID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement