Create View V_View 
as
select 
   开始站名=(select 站名 from 站名表 where 站编号=A.开始站编号),  
   人数=A.人数,  
   目的站名=(select 站名 from 站名表 where 站编号=A.目的站编号),  
from
  事件表 A    

解决方案 »

  1.   

    --trycreate view vw_get
    as
    select 开始站名=(select stationDes from 站名表 where id=a.bstation),
           人数=a.PNum,
    目的站名=(select stationDes from 站名表 where id=a.EStation)
    from 事件表 a
    go
      

  2.   

    select (select stationdes from 站名表 where id = t.Bstation) as 开始站名,
           人数,
           (select stationdes from 站名表 where id = t.EStation) as 目的站名
    from 事件表
      

  3.   

    select (select stationdes from 站名表 where id = t.Bstation) as 开始站名,
           人数,
           (select stationdes from 站名表 where id = t.EStation) as 目的站名
    from 事件表 t
      

  4.   

    Create View VW_Test 
    as
    select b.stationDes as 开始站名,  a.人数 as 人数, c.stationDes  as  目的站名 
    from  事件表 a, 站名表 b, 站名表 c
    where a.开始站编号=b.站编号 and 
          a.目的站编号=c.站编号 
      

  5.   

    select b.Station,c.Envent_desc,a.Pnum,d.Station,a.num,d.price as 目的价,b.price as 本站价,(d.price -b.price)*a.num as 应收票款 from
        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