
December 6th, 2003, 01:31 PM
|
|
Junior Member
|
|
Join Date: Aug 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Query problem
I'm running an SQL Query to return a list of all games that it's the current players go - but displaying all the opponents
Code:
"SELECT " & _
"GameTable.[Game#] AS [G #], " & _
"PlayerTable.[Player#] AS [P #], " & _
"playerTable.[PlayerID] as [Opponent], " & _
"FROM UserTable INNER JOIN (GameTable INNER JOIN PlayerTable ON GameTable.[Game#] = PlayerTable.[Game#]) ON UserTable.UserID = PlayerTable.PlayerID " & _
"WHERE " & _
"(GameTable.[Game#] in (SELECT playerTable.[Game#] FROM PlayerTable WHERE ((PlayerTable.PlayerID)='" & Vars.CurrentUserID & "')and ((PlayerTable.[Player#])=(GameTable.[CurrentPlayer]))))" & _
"and ((PlayerTable.PlayerID)<>'" & Vars.CurrentUserID & "') "
This query get's a line for every opponent but my problem is that i want to add more then one opponent and i don't want more then one line per game
I would like to put them all the opponent's names [comma seperated] into one cell
can this be done all in one SQL Statement?
Your help would be greatly appreciated
|