开发者

How to make this query?

I have two tables:

Teams

  • id
  • name

Games

  • id
  • date
  • idlocal
  • idvisitor

idlocal and idvisitor 开发者_运维知识库are the id of the teams in the teams table.

I need to make a SQL query that returns the date, the NAME of the first team, and the NAME of the second team, but I don't know how to do it.

Thanks


SELECT date,t1.name,t2.name FROM 
games g 
INNER JOIN teams t1 on t1.id=g.idlocal
INNER JOIN teams t2 on t2.id=g.idvisitor
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜