我有这个查询
SELECT users.name
FROM users
LEFT JOIN weapon_stats ON users.id = weapon_stats.zp_id
WHERE weapon_stats.weapon = 26
ORDER BY weapon_stats.kills DESC
LIMIT 1;
问题是你需要得到从 1 到 30 变化的结果,这很奇怪..
是否可以在一个查询中获得所有结果?
我想让每个用户用每种武器杀死最多
武器 1
SELECT users.name
FROM users
LEFT JOIN weapon_stats ON users.id = weapon_stats.zp_id
WHERE weapon_stats.weapon = 01
ORDER BY weapon_stats.kills DESC
LIMIT 1;
武器 2
SELECT users.name
FROM users
LEFT JOIN weapon_stats ON users.id = weapon_stats.zp_id
WHERE weapon_stats.weapon = 02
ORDER BY weapon_stats.kills DESC
LIMIT 1;
提前致谢!