【发布时间】:2013-12-28 10:44:28
【问题描述】:
select offices.office_id,
count(staff_id)
from offices join staffs using (office_id) join managers using (manager_id)
group by office_id;
我一直在努力
第 1 行出现错误:ORA-25154:USING 子句的列部分不能有限定符。
我正在尝试计算不同办公室的员工总数。在这里,我按办公室 ID 对结果进行了分组。这里出了什么问题。
但如果我喜欢这样
select count(staff_id)
from offices join staffs using (office_id) join managers using (manager_id)
group by office_id;
因为我删除了offices.office_id column,它以这种方式工作并且只显示一列。但是我需要在两列中并排放置相应数量的员工的办公室 ID。
【问题讨论】:
-
按office.office_id使用组