Create View V_View
as
select
开始站名=(select 站名 from 站名表 where 站编号=A.开始站编号),
人数=A.人数,
目的站名=(select 站名 from 站名表 where 站编号=A.目的站编号),
from
事件表 A
as
select
开始站名=(select 站名 from 站名表 where 站编号=A.开始站编号),
人数=A.人数,
目的站名=(select 站名 from 站名表 where 站编号=A.目的站编号),
from
事件表 A
as
select 开始站名=(select stationDes from 站名表 where id=a.bstation),
人数=a.PNum,
目的站名=(select stationDes from 站名表 where id=a.EStation)
from 事件表 a
go
人数,
(select stationdes from 站名表 where id = t.EStation) as 目的站名
from 事件表
人数,
(select stationdes from 站名表 where id = t.EStation) as 目的站名
from 事件表 t
as
select b.stationDes as 开始站名, a.人数 as 人数, c.stationDes as 目的站名
from 事件表 a, 站名表 b, 站名表 c
where a.开始站编号=b.站编号 and
a.目的站编号=c.站编号
Test_Envent a
left join Test_Station b on a.Station=b.id
left join Test_Station d on a.AimStation=d.id
left join Test_EnventDesc c on a.Envent=c.Envent