我得到错误" ORA-00907:缺少右括号"但是我检查过了,所有的括号都在那里,所以我被难住了。
我的查询是
SELECT
SUM(score) as score,
facebook_id,
firstname,
lastname,
dense_rank(score)
WITHIN GROUP ( ORDER BY score ) as rank_db
FROM
(
SELECT DISTINCT *
FROM
(
SELECT *
FROM fanta_score
ORDER BY score desc
) as f
GROUP BY
facebook_id, game_id
) as g
GROUP BY facebook_id
ORDER BY score DESC, created_at
LIMIT 50
我绝不是Oracle专家,但我必须使用它,因为它必须在托管环境
LIMIT命令在Oracle中不被识别。并且应该使用ROWNUM而不是Limit。
SELECT
SUM(score) as score,
facebook_id,
firstname,
lastname,
dense_rank(score)
WITHIN GROUP ( ORDER BY score ) as rank_db
FROM
(
SELECT DISTINCT *
FROM
(
SELECT *
FROM fanta_score
ORDER BY score desc
) as f
GROUP BY
facebook_id, game_id
) as g
WHERE ROWNUM = 50
GROUP BY facebook_id
ORDER BY score DESC, created_at