0

试着看看哪个球员进球最多。

Player_id
Goals.

我尝试了以下语句:

select player_id, sum(goals) as total
from matchstat
group by player_id
order by total desc limit 1;

但我得到错误:

SQL 命令未正确结束。

有人看到查询的问题吗?

4

1 回答 1

2

Oracle 不支持limit 子句。尝试

SELECT * 
FROM   (SELECT "player_id", 
               SUM("goals") AS total 
        FROM   matchstat 
        GROUP  BY "player_id" 
        ORDER  BY total DESC) a 
WHERE  ROWNUM <= 1 

查看演示

于 2013-04-26T19:39:37.000 回答