我有一个团队联盟。我想使用一个选择命令,将表中的每支球队与同一个联赛中的所有其他球队进行匹配。
球队表(球队,得分,比赛)
例如说这个表里面有这个:
team1, 3, 2
team2, 5, 1
team3, 2, 4
team4, 1, 5
我想使用一个选择命令,它会给我这个结果
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
有任何想法吗?
谢谢,