Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从MAX(SUM())SQL GROUP BY获取ID_Sql_Oracle - Fatal编程技术网

从MAX(SUM())SQL GROUP BY获取ID

从MAX(SUM())SQL GROUP BY获取ID,sql,oracle,Sql,Oracle,我试图从下图中得到的结果中获取PlayerID 我用来显示的查询是: SELECT PlayerIDFK, sum(TwoPointMade) as TwoPointMade, sum(ThreePointMade) as ThreePointMAde FROM PlayerPerformance GROUP BY PlayerIDFK; 我还有另一个查询,在本例中返回两列总和的最大值47,这是正确的答案,但我还想得到PlayerIDFK SELECT MAX(SUM(TwoPointMa

我试图从下图中得到的结果中获取PlayerID

我用来显示的查询是:

SELECT PlayerIDFK, sum(TwoPointMade) as TwoPointMade, sum(ThreePointMade) as ThreePointMAde 
FROM PlayerPerformance GROUP BY PlayerIDFK;
我还有另一个查询,在本例中返回两列总和的最大值47,这是正确的答案,但我还想得到PlayerIDFK

SELECT MAX(SUM(TwoPointMade) + SUM(ThreePointMade)) AS "Points"
FROM PlayerPerformance GROUP BY PlayerIDFK;
当我尝试使用查询获取播放器ID时,我没有得到一个组函数。这是我尝试使用的查询:

SELECT PlayerIDFK, MAX(SUM(TwoPointMade) + SUM(ThreePointMade)) AS "Points"
FROM PlayerPerformance GROUP BY PlayerIDFK;

使用
orderby
rownum
(或
仅获取12c+中的前1行


请仅使用与您使用的技术相匹配的标签。是,还是?这不是
分组依据的作业<代码>分组依据
不从表中返回行。它生成新行。第5行错误:ORA-00935:组函数嵌套太深请尝试按顺序删除sum()包装。
SELECT *
FROM (SELECT PlayerIDFK, sum(TwoPointMade) as TwoPointMade, sum(ThreePointMade) as ThreePointMAde 
      FROM PlayerPerformance
      GROUP BY PlayerIDFK
      ORDER BY ( sum(TwoPointMade) + sum(ThreePointMade) ) desc
     ) pp
WHERE rownum = 1;