Home:ALL Converter>Group Function not working on Oracle

Group Function not working on Oracle

Ask Time:2017-01-05T23:46:25         Author:user6611026

Json Formatter

I'm practicing functions on Oracle SQL, and now I'm trying to code a group function to print on console AVG salary group by departments id, and I want to add the column department name from another table. I think my syntax is correct but anyway I received an Oracle Error.

SELECT   e.department_id, d.department_name, e.AVG(salary)
FROM     employees e
JOIN     departments d
ON      (e.department_id = d.department_id)
GROUP BY department_id, department_name;

ORA-00918: column ambiguously defined 00918. 00000 - "column ambiguously defined" *Cause:
*Action: Error en la línea: 5, columna: 10

Author:user6611026,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41489079/group-function-not-working-on-oracle
yy