我使用此代码:
$sql = "SELECT DISTINCT(name) AS name FROM Tags ORDER BY name DESC"
但是我如何通过计算值对它进行排序?
类似的东西:
$sql = "SELECT DISTINCT(name) AS name FROM Tags ORDER BY count(name) DESC"
答案 0 :(得分:0)
SELECT count(name) as count, name
FROM Tags
GROUP BY name
ORDER BY count DESC;