码迷,mamicode.com
首页 > 其他好文 > 详细

V_REPORT_AOC_FUEL]

时间:2015-05-19 22:27:09      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:

select * from DISPATCH order by FLTID desc
SELECT TOP 1000 [FLTID]
      ,[VIP_ID]
      ,[VIP_NAME]
      ,[GENDER]
      ,[VIP_POS]
      ,[VIP_AGE]
      ,[VIP_HOBBY]
      ,[VIP_REMARK]
      ,[PHOTO]
      ,[VIP_TYPE]
      ,[VIP_CONTACT]
  FROM [ISA].[dbo].[V_FLIGHTS_VIPS]
  
select top 1  * from AIRLINES_FLighttime
order by ACTYPE,SEASON 
Select * from Dispatch

select * from v_REPORT_AOC

CREATE VIEW [dbo].[V_REPORT_AOC_FUEL]
/*-------------------------------------------------------------------------------
创建时间: 04/03/2015 17:00:48     
用途: 统计 
创建人 :        
 ----------------------------------------------------------------------------------*/     

AS

SELECT 
日期    =DBO.PEK_OPS_Date(A.STD),
航班号  =RIGHT(A.FLTNO,LEN(A.FLTNO) - 2) ,
飞机    =RIGHT(AC, 5),
机型    =LEFT(AC,4),
起飞机场=A.DEPSTN ,
目的机场=A.ORIARRSTN,
计划起飞=DBO.ShortTime(DBO.PEKTime(A.STD)),
实际起飞=DBO.ShortTime(DBO.PEKTime(A.ATD)),
计划落地=DBO.ShortTime(DBO.PEKTime(A.STA)),
实际落地=DBO.ShortTime(DBO.PEKTime(A.ATA)),
CFP耗油 = CASE WHEN c.CFP IS NULL then 0 else c.TRIP_FUEL   END,
航线耗油= CASE WHEN c.CFP IS NULL then 
                    case when c.TRIP_FUEL IS NULL then
                              g.TRIP_FUEL else c.TRIP_FUEL
                    end 
                 ELSE  0 
               END
 from FLIGHTS a left join Dispatch c on c.FLTID=a.FLTID
 left join  (select D.SEASON,D.ACTYPE,D.TRIP_FUEL,E.DEPSTN,E.ARRSTN  from AIRLINES_Routes_Fuel D ,AIRLINES_ROUTES e
             WHERE E.ROUTE_ID=d.ROUTE_ID) AS G 
             ON   A.DEPSTN=g.DEPSTN and a.ARRSTN=g.ARRSTN and
                 dbo.GetSeason(a.STD)=g.season AND LEFT(A.AC,4)=G.ACTYPE
 where a.status<>CNLand ETD > 2015-04-01 00:00:00
 
 


  
     
    
      
      
      

 

V_REPORT_AOC_FUEL]

标签:

原文地址:http://www.cnblogs.com/moonwind/p/4515516.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!