建表并插入数据:create table tt(sal int,deptno int);insert into tt values (2450,10),(1300,10),(1300,10),(5000,10),(4000,20);查询:select sum(distinct sal) over(partition by deptno) sal,deptno from tt;DB2 Database Error: ERROR [42601] [IBM][DB2/NT] SQL044...
显示全部建表并插入数据:
create table tt(sal int,deptno int);
insert into tt values (2450,10),(1300,10),(1300,10),(5000,10),(4000,20);
查询:
select sum(distinct sal) over(partition by deptno) sal,deptno from tt;
DB2 Database Error: ERROR [42601] [IBM][DB2/NT] SQL0441N Invalid use of keyword DISTINCT or ALL with function "SUM". SQLSTATE=42601
请问各位大哥,这条sql应该怎么写才能成功呢?
收起