Advertisement
VoronVU

Untitled

Mar 27th, 2015
2,519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   l.LAB_NAME,
  3.   l.SALARY,
  4.   d.DEP_NAME
  5. FROM
  6.   LABORING l,
  7.   DEPARTAMENT d,
  8.  
  9. (SELECT
  10.   d.DEP_ID,
  11.   MAX(l.SALARY) AS SALARY_MAX
  12. FROM
  13.   LABORING l,
  14.   DEPARTAMENT d
  15. WHERE l.DEP_ID = d.DEP_ID
  16. GROUP BY l.DEP_ID) sq
  17.  
  18.   WHERE l.DEP_ID = sq.DEP_ID
  19.     AND l.SALARY = sq.SALARY_MAX
  20.     AND d.DEP_ID = sq.DEP_ID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement