Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --6
- --27 rows
- --count(*) broken when you left join, returns 1 no matter what...
- SELECT
- 'Departamentul '
- || D.DEPARTMENT_NAME
- || ' este condus de '
- || NVL(TO_CHAR(D.MANAGER_ID), 'nimeni')
- || ' si '
- || DECODE(COUNT(E.EMPLOYEE_ID), 0, 'nu are salariati', 'are numarul de angajati '
- || TO_CHAR(COUNT(E.EMPLOYEE_ID)))
- -- || DECODE(COUNT(E.EMPLOYEE_ID), 0, ', de ce count(*)='
- -- || COUNT(*)
- -- || '?', '') STATEMENT
- FROM
- DEPARTMENTS D,
- EMPLOYEES E
- WHERE
- E.DEPARTMENT_ID (+) = D.DEPARTMENT_ID
- GROUP BY
- D.DEPARTMENT_ID,
- D.DEPARTMENT_NAME,
- D.MANAGER_ID;
- --ORDER BY
- -- COUNT(E.EMPLOYEE_ID);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement