返回SQL Assist-To-Turnover比率

时间:2014-09-27 19:30:20

标签: sql

Access告诉我ROUND表达式不是聚合函数的一部分。

SELECT DISTINCT PlayerName, ROUND(g.A / g.TO,2) AS ATORatio
FROM (SELECT * FROM Players_t P INNER JOIN GameStats_t G ON P.JerseyNumber=G.JerseyNumber WHERE g.TO>0)
WHERE g.A/g.TO < (SELECT SUM(A)/SUM(TO) FROM GameStats_t)
GROUP BY PlayerName;

1 个答案:

答案 0 :(得分:1)

以下查询可以帮助您。

ROUND的语法是ROUND (VALUE, PRECISION)
所以,我刚刚添加了另一个问题(g.A / g.TO),以确保维护语法。

SELECT DISTINCT PlayerName, ROUND( (g.A / g.TO),2) AS ATORatio
FROM (SELECT * FROM Players_t P INNER JOIN GameStats_t G 
       ON P.JerseyNumber=G.JerseyNumber WHERE g.TO>0)
WHERE (g.A/g.TO) < (SELECT SUM(A)/SUM(TO) FROM GameStats_t)
GROUP BY PlayerName;