Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody. I have a table like this:
ID_game |  ID_team  | points | home
-------------------------------------
1       |  1        | 87     | true
-------------------------------------
1       |  2        | 79     | false


How can I display points of teams who played the match in the same row, like this:
87 | 79


What I have tried:

It's easy for me to display points in different rows like this:
87
---
79

Thanks in advance.
Posted
Updated 19-May-16 1:38am

1 solution

Try:
SQL
SELECT a.ID_game, a.ID_team AS Home, a.Points AS [Home Points], b.ID_team AS Away, b.Points AS [Away Points] FROM MyTable a
JOIN MyTable b ON a.ID_game = b .ID_game AND a.home = 1 AND b.Home = 0
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900