如何将我自己的数字插入分区查询?

时间:2015-10-22 20:01:57

标签: php mysql

我的查询效果很好。唯一的问题是它除了从select语句中从我的数据库中提取的行数。我该如何更改

(SELECT COUNT(*) FROM saved_players))

让我们说1000? 1000是会员总数。

$query= "SELECT *, COUNT(*) AS Total , (COUNT(*) / (SELECT COUNT(*) FROM saved_players)) * 100 AS totalnumber
FROM saved_players
GROUP BY fname";

所以我正在寻找类似下面的内容,但它不起作用。

$query= "SELECT *, COUNT(*) AS Total , (COUNT(*) / 1000 * 100 AS totalnumber
FROM saved_players
GROUP BY fname";

1 个答案:

答案 0 :(得分:0)

$query= "SELECT *, COUNT(*) AS Total , (COUNT(*) / 1000 * 100) AS totalnumber
FROM saved_players
GROUP BY fname";

看起来像缺少括号)

希望这有帮助