3
此查询不起作用。有人能帮助我吗?一个查询中有多个计数
$query = "SELECT
COUNT(WHERE Name='george') AS george_total,
COUNT(WHERE Name='michael') AS michael_total,
COUNT(WHERE Name='mike') AS mike_total
FROM users WHERE Banned IS NOT '1' AND Active='yes' AND Logins>1 AND Registered_to_forum='1'";
$row=mysql_fetch_array($result);
echo "
We found $row['george_total'] people with the name 'George' in our database,
$row['michael_total'] with the name Michael
and $row['mike_total'] with the name Mike.
";
谢谢,但它并没有返回例如乔治的量,它只返回1或0.不是10乔治或类似的东西。 – Jordy
@Jordy - 那么你只能有一个乔治。两个查询都正常工作。也许你是因为你的“where”条款而排除他们? –
它的工作原理;-)非常感谢! – Jordy