假设A表名称:City,B表名称:GoTo
select a.CityName as '出发地', b.CityName as '目的地', c.LeaveDate as '出发时间'
from City as a, City as b, Goto as c
where c.FromCity = a.CityID
and c.ToCity = b.CityID
笔记
本文介绍了一种通过 SQL 查询连接三个表 (City 和 GoTo) 的方法来获取出发地、目的地及出发时间等信息。此查询对于组织和展示出行数据非常有用。
假设A表名称:City,B表名称:GoTo
select a.CityName as '出发地', b.CityName as '目的地', c.LeaveDate as '出发时间'
from City as a, City as b, Goto as c
where c.FromCity = a.CityID
and c.ToCity = b.CityID
笔记

被折叠的 条评论
为什么被折叠?