|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Can anyone tell me if there is a way in MS SQL to combine multiple row's into one
eg A B C 1 1 1 1 1 2 1 2 1 1 2 2 1 2 3 i want this displayed as A B AllC 1 1 1,2 1 2 1,2,3 can this be done? |
|
#3
|
||||
|
||||
|
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Query problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|