I’m having big troubles with a more complicated (or my mind makes it so) SQL query. Ill try to explain as best as I can what is needed.
This is how it looks like essentially: https://i.stack.imgur.com/My5uD.png
The idea is that there will be sport games where kids team up with pro’s and they have a tournament. Now everything works fine untill I get to the score part.
I need a query that return a game’s outcome in 4 colomns:
winchildname, winproname, losechildname, loseproname.
This way its easy to display in my C# project. If i use this query:
SELECT * FROM Games WHERE g_win = 1 OR g_lose = 1
This returns every game played by child with the k_id 1 but the outcome is in ints instead actual text. I know how to inner join 1 int so it becomes text, but not 2. Because g_win and g_lose are both a k_id out of the child table.
Is there someone that can give me a hint, because I feel that im overthinking this big time.
You can join multiple times on the same table by giving the table an alias: