Self Join - To use a repeat region in recordset
What does the Games table have in it? It looks like it already has an oppo1 and oppo2... so what do you get with just select * from games?
I think if I understand the columns in the games table better then I can probably help you write the correct query.
Yes the Games table does have oppo1 and oppo2. I figured out a workaround so I don't have to use the join. However, I did really close. I'm trying to make all the gameID be on the same row as the team. The GameIDs are separate entries into the database so I'm having trouble grouping them as a team. I need to group the gameID on the same row and show entries also where gameID is null. Here is what I'm getting using this join:
SELECT DISTINCT ME.gameID, ME.teamID, E.oppo1, ME.oppo2
FROM games ME
INNER JOIN games E
ON ME.teamID = E.teamID AND ME.oppo2 < E.oppo1
Game ID TeamID Oppo1 Oppo2
186 218 Trigg County Boston Celtics
187 219 Tates Creek Paris Western
This is the output I'm looking for. I have another team in the database. Team 217. Team 217 oppo2 is null. Therefore, the query I'm looking for should produce this:
Game ID TeamID Oppo1 Oppo2
186 218 Trigg County Boston Celtics
187 219 Tates Creek Paris Western
188 217 Maysville