我有一个查询显示TyreMan
列中最常见的值。此列中的很多值都是空的,所以我试图忽略它们,但它似乎没有工作。
$result = mysql_query("SELECT TyreMan, COUNT(TyreMan) AS countTyreMan
FROM Pictures
WHERE Tyreman IS NOT NULL
GROUP BY TyreMan
ORDER BY countTyreMan DESC
LIMIT 1");
我把它放错了地方吗?
感谢
答案 0 :(得分:0)
试试这个
$result = mysql_query("SELECT TyreMan, COUNT(TyreMan) AS countTyreMan
FROM Pictures WHERE (Tyreman) IS NOT NULL
GROUP BY TyreMan ORDER BY countTyreMan DESC LIMIT 1");
使用()列名称。