Advertisement
VoronVU

Untitled

Mar 27th, 2015
1,171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   d.DEP_NAME, sq.LAB_CNT
  3. FROM DEPARTAMENT d,
  4.  
  5.   (SELECT
  6.     d.DEP_ID, COUNT(*) AS LAB_CNT
  7.   FROM
  8.     LABORING l,
  9.     DEPARTAMENT d
  10.   WHERE l.DEP_ID = d.DEP_ID
  11.     GROUP BY d.DEP_ID
  12.   HAVING COUNT(*) <= 3) sq
  13.  
  14. WHERE d.DEP_ID = sq.DEP_ID
Advertisement
RAW Paste Data Copied
Advertisement