我想將第二個查詢合併爲第一個查詢結果中的一列。我需要在MySQL中結合兩個select查詢
首先查詢:
Select
snpc_stats.gamedetail.Player,
Sum(snpc_stats.gamedetail.Points + snpc_stats.gamedetail.Hits) As Points,
COUNT(*) As 'Games Played',
Avg(snpc_stats.gamedetail.Finish) As 'Average Finish',
Sum(snpc_stats.gamedetail.Hits) As `Total Hits`
From
snpc_stats.gamedetail Inner Join
snpc_stats.games On MOM_snpc_stats.games.GameID =
snpc_stats.gamedetail.GamesID
Where
snpc_stats.games.Season = '2014 Season'
Group By
snpc_stats.gamedetail.Player, MOM_snpc_stats.games.Season
Order By
Points Desc
第二個查詢:
Select
snpc_stats.gamedetail.Player,
Sum(snpc_stats.gamedetail.Finish) As Second
From
snpc_stats.gamedetail Inner Join
snpc_stats.games On MOM_snpc_stats.games.GameID = snpc_stats.gamedetail.GamesID
Where
snpc_stats.gamedetail.Finish = 1 And
snpc_stats.games.Season = '2014 Season'
Group By
snpc_stats.gamedetail.Player, snpc_stats.games.Season
不知道如何去了解這個......
作爲一個列?你可以'SELECT(select ...)AS'' something''' - 但是如果這個子查詢有多於1個結果,你可能會被f'd – 2015-02-05 21:39:07