2

我有一个名为 Timings 的表,其中包含以下内容

Id   Team1     Team2           MD          MT
1    Name1     Name2    26/07/2013   10.00
2    Name3     Name4    26/07/2013   11.00

另一个名为 Players 的表

Id     Name    Email  
Name1  Naveen  email  
Name2  Bos     email
Name3  Sharath email
Name4  mohan   email

我需要这样的结果,是否可以在单个查询中获得结果?

MD          MT      PlayerName1  playername2
26/07/2013  10.00   Naveen       Bos
4

1 回答 1

2

Try double join as below

select T.MD,T.MT,P1.Name as PlayerName1, P2.Name as playername2 
from Timings T
join Players P1 on P1.Id = T.Team1
join Players P2 on P2.Id = T.Team2
于 2013-07-26T13:17:42.433 回答