oracle - ORA-00918: column ambiguously defined with [group by] -


in sql have these table

create table employee( emp_ssn number(10), first_name varchar2(10) not null , second_name varchar2(10), last_name varchar2(10) not null , address varchar2(20) , birthdate date not null  , super_ssn number(10), job_no  number (2), constraint employee_pk primary key (emp_ssn)); 

create table job ( job_no number (2), job_name varchar2(11) , constraint job_pk primary key (job_no )); 

and write query display how many employee in each job using group by

select     job_no, job_name,count(emp_ssn)       job j join employee e on         (j.job_no = e.job_no) group   j.job_no, j.job_name; 

and output

select     job_no, job_name,count(emp_ssn)    job j join employee e on       (j.job_no = e.job_no) group   j.job_no, j.job_name; select     job_no, job_name,count(emp_ssn) 

error @ line 1: ora-00918: column ambiguously defined

can me please !

select      j.job_no           --<-- missing alias here           , j.job_name         --<-- here           ,count(e.emp_ssn)    --<-- , here       job j join employee e on         (j.job_no = e.job_no) group   j.job_no, j.job_name; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -