我有了這個查詢獲取所有WHERE在一個查詢案件
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;
它使y需要得到的結果變化,其中從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;
提前感謝!
我需要得到每個查詢的結果,從0值設爲1。我不想使30個queryes(WHERE weapon_stats.weapon = 1,其中weapon_stats.weapon = 2,其中weapon_stats.weapon = 3)等... – Zuker 2013-05-10 20:42:40
'WHERE weapon_stats.weapon介於1和30之間'也可以運行 – Bert 2013-05-10 20:43:17
mmm,請檢查我的編輯,我想現在你可以理解它了! – Zuker 2013-05-10 20:47:19