P
pat67
Hi I am trying to run a query to show what a player's current and
winning streak is. I was told to use this query to start. This gives
the player and the last game he lost:
SELECT playerID, MAX(gameID) AS mgame
FROM myData
WHERE NOT isWin
GROUP BY playerID
----------------------------------------
saved as qlatestLost
Then use the below query to give the number of games after the last
loss
-------------------------------
SELECT playerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
Problem is this query is not working. When i run it as is I get an
error stating that playerID could come from more than one table. So
then i changed it to
SELECT myData.playerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
and got an error message stating that i tried to execute a query that
does not include the specified expression 'playerID' as part of an
aggregate function. so i changed it to
SELECT qlatestLost.PlayerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
and got the same error.
Can someone tell me what the problem is?
Thanks
winning streak is. I was told to use this query to start. This gives
the player and the last game he lost:
SELECT playerID, MAX(gameID) AS mgame
FROM myData
WHERE NOT isWin
GROUP BY playerID
----------------------------------------
saved as qlatestLost
Then use the below query to give the number of games after the last
loss
-------------------------------
SELECT playerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
Problem is this query is not working. When i run it as is I get an
error stating that playerID could come from more than one table. So
then i changed it to
SELECT myData.playerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
and got an error message stating that i tried to execute a query that
does not include the specified expression 'playerID' as part of an
aggregate function. so i changed it to
SELECT qlatestLost.PlayerID,
COUNT(qlatestLost.PlayerID) AS actualWinStreak
FROM myDataLEFT JOIN qlatestLost
ON myData.playerID = qlatestLost.playerID
AND myData.gameID > qlatestLost.mgame
and got the same error.
Can someone tell me what the problem is?
Thanks