group by 后面不應該有b.timestr啊......寫成
select a.user_name,b.timestr,max(b.kills) from user1 a join user_kills b on a.id = b.user_id group by a.user_name;
是完全可以查詢出結果的。
老師的分組查詢中,分組錯誤導致沒有得到結果。
select a.user_name,b.timestr,max(b.kills)
from user1 a join user_kills b on a.id = b.user_id
group by a.user_name。該語句建議最后見“order by null”
算上老師最后給出的兩次join的方式,可以explain 看一下3中方式哪個最優。