如何找到lasthit或mostdamage的表player_frags
中最常见的值,并按asc命令?
SELECT DISTINCT(name) FROM players p
INNER JOIN player_frags pf ON pf.lasthit = p.name
OR pf.mostdamage = p.name
答案 0 :(得分:2)
SELECT name FROM players p
INNER JOIN player_frags pf ON pf.lasthit = p.name
OR pf.mostdamage = p.name GROUP BY name Order By COUNT(*) DESC
您可以在最后添加LIMIT 1以获得最常见的名称。
答案 1 :(得分:1)
我认为您没有尝试过,这看起来与您在发送的其他问题中发布的其他SQL完全相同
无论如何,这将返回名称与出现的频率:
SELECT COUNT(*) AS Freq, name
FROM players
GROUP BY players.name
ORDER BY COUNT(*)