当我执行以下代码时,语法错误为syntax error near : "("
。我无法找出错误是什么。
我的查询:
Select id, name, AVG(salary) over (order by salary) as aver from test;
答案 0 :(得分:0)
使用testdata和您的语句的示例。 它没有语法错误:
CREATE TABLE test
( id int
,name varchar(20)
,salary int
)
;
INSERT INTO test VALUES (1,'John', 2500);
INSERT INTO test VALUES (2,'Jack', 3500);
INSERT INTO test VALUES (3,'William', 4500);
INSERT INTO test VALUES (4,'Avarel', 7200);
Select id
,name
,AVG(salary)
over (order by salary) as aver
from test;
答案 1 :(得分:-3)
您需要以这种方式修改查询
Select id, name, AVG(salary) as over from test order by salary;
也许它会有所帮助。