我有这些表
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 ));
我写了一个查询,显示每个员工中有多少员工
使用小组的工作SELECT job_no, job_name,COUNT(emp_ssn)
FROM job j JOIN employee e
ON (j.job_no = e.job_no)
GROUP BY j.job_no, j.job_name;
,输出
SELECT job_no, job_name,COUNT(emp_ssn)
FROM job j JOIN employee e
ON (j.job_no = e.job_no)
GROUP BY j.job_no, j.job_name;
SELECT job_no, job_name,COUNT(emp_ssn)
你可以帮帮我吗?第1行的错误:ORA-00918:列模糊定义
答案 0 :(得分:1)
SELECT j.job_no --<-- you are missing alias here
, j.job_name --<-- here
,COUNT(e.emp_ssn) --<-- and here
FROM job j JOIN employee e
ON (j.job_no = e.job_no)
GROUP BY j.job_no, j.job_name;