creating joins between tables with "group by" clause to limit rows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tamer Higazi

    creating joins between tables with "group by" clause to limit rows

    Hi!
    I have problems creating joins between tables and to limit rows for a
    specified clolumn. I have 2 tables!

    employees
    departments

    I face the problems with the GROUP BY clause and i don't get it handled
    solving that problem. Neither with oracle sql or SQL1999 syntax!

    Oracle SQL:

    SELECT
    dep.department_ name as "Name",
    dep.location_id as "Location",
    emp.salary AS "Salary"
    FROM employees emp, departments dep
    WHERE (emp.department _id = dep.department_ id)
    GROUP BY dep.department_ name;

    SQL1999:

    SELECT
    department_name as "Name",
    location_id as "Location",
    salary AS "Salary"
    FROM employees emp
    JOIN departments dep
    USING(departmen t_id)
    GROUP BY department_id;


    for any help


    Thank you


    Tamer
Working...