您可能需要一些板球知識來幫助解決這個問題。鑑於下表,這個查詢會產生這個結果嗎?擊球平均MySQL查詢
Table: batsmen
batsmanname | runsscored | howout
Colin | 10 | bowled
Colin | 20 | caught
Steve | 10 | bowled
Steve | 20 | not out
SELECT batsmanname, SUM(runsscored)/COUNT(howout) AS battingavg
FROM batsmen
WHERE howout <> 'not out'
GROUP BY batsmananme
Result:
batsmanname | battingavg
Colin | 15
Steve | 30
* * - 你試試吧 「將這個查詢產生這樣的結果?」? (它看起來似乎有道理,但'AS'似乎在錯誤的地方) – Flexo 2012-07-20 15:05:30