视图没有创建

时间:2015-11-30 02:28:29

标签: sql oracle sql-view

尝试在oracle 11g中编写视图
我希望这段代码只返回拥有的员工的第一个名字和姓氏。
但它继续给我错误:“ORA-00979:不是GROUP BY表达式”

create or replace view highesttotalcommission as (
    select *
    from  (     select e.firstname|| ' ' ||e.lastname "Highest commission"
            from employee e
            inner join salesperson sp
            on e.employeeID = sp.employeeID
            inner join salesinvoice si
            on si.salespersonid = e.employeeID
            group by si.salespersonid
            order by SUM(si.price * sp.commissionpct) desc )
    where ROWNUM = 1);

1 个答案:

答案 0 :(得分:0)

我认为错误非常明显。您需要在school[row][cols]中的select中包含列或表达式:

group by