我有一个团队联盟。我想使用一个select命令来匹配表中每个团队与同一联盟中所有其他团队的匹配。
球队表(球队,得分,比赛)
例如说这个表中有这个:
team1, 3, 2
team2, 5, 1
team3, 2, 4
team4, 1, 5
我想使用一个select命令给我这个resutl
team1 | team2
team4 | team3
team1 | team3
team2 | team4
基本上我希望通过select语句
生成游戏时间表我尝试过类似的事情:
select t.team, t1.team from teams t, teams t1 where t.league = '5a7' AND t.league = t1.league AND t.team != t1.team
但该查询的结果如下所示
team1 | team2
team3 | team2
team4 | team2
team2 | team1
team3 | team1
team4 | team1
有什么想法吗?
谢谢,