sql查询分析器显示的8624错误,该怎么办? 把你的语句和你的表结构和数据贴出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select 0--X1.运单号,X1.后缀,始发站,目的站,在站件数,总件数,特货码,所在容器,位置,容器类别,装载货物件数,重量from(----------------------------------begin---------------------------------------------------selectT1.AWB_Prefix + '-' + T1.AWB_No 运单号,T1.AWB_Postfix 后缀,T5.Dep 始发站,T5.Dest 目的站,sum(T1.Piece) 在站件数,sum(T4.Piece) 总件数,T4.SpeCode 特货码fromTBL_CargoBill T1inner joinTBL_Cargo_Container T2on T1.Rec_ID = T2.Rec_IDinner joinTBL_Container T3on T3.Container_Code = T2.Container_Codeleft outer joinTBL_Cargo_PW T4on T1.AWB_Prefix = T4.AWB_Prefix and T1.AWB_No = T4.AWB_No and T1.AWB_Postfix = T4.AWB_Postfixleft outer joinTBL_AWB_Basic T5on T1.AWB_Prefix = T5.AWB_Prefix and T1.AWB_No = T5.AWB_No and T1.AWB_Postfix = T5.AWB_Postfixwhere T1.CargoArr_Flag = 0and T1.Finish_Flag = 0and T3.Location_Code != 'SKY'and T3.Location_Code != 'AWAY'group byT1.AWB_Prefix,T1.AWB_No,T1.AWB_Postfix,T5.Dep,T5.Dest,T4.SpeCode--------------------------------------end---------------------------------------------) X1left outer join(------------------------------------------------------------------------------------------------------------------------begin--------------------------------------------selectT1.AWB_Prefix + '-' + T1.AWB_No 运单号,T1.AWB_Postfix 后缀,T1.Rec_ID 记录号,T3.Container_Code 所在容器,T3.Location_Code 位置,T3.UCBFlag 容器类别,sum(T2.Piece) - isnull((select sum(Piece) From TBL_Cargo_Container where Rec_ID = T1.Rec_ID and Container_Code = 'AWAY' group by Rec_ID), 0) 装载货物件数,sum(T2.Weight) - isnull((select sum(Weight) From TBL_Cargo_Container where Rec_ID = T1.Rec_ID and Container_Code = 'AWAY' group by Rec_ID), 0) 重量fromTBL_CargoBill T1inner joinTBL_Cargo_Container T2on T1.Rec_ID = T2.Rec_IDinner joinTBL_Container T3on T3.Container_Code = T2.Container_Codeleft outer joinTBL_Cargo_PW T4on T1.AWB_Prefix = T4.AWB_Prefix and T1.AWB_No = T4.AWB_No and T1.AWB_Postfix = T4.AWB_Postfixleft outer joinTBL_AWB_Basic T5on T1.AWB_Prefix = T5.AWB_Prefix and T1.AWB_No = T5.AWB_No and T1.AWB_Postfix = T5.AWB_Postfixwhere T1.CargoArr_Flag = 0and T1.Finish_Flag = 0and T3.Location_Code != 'SKY'and T3.Location_Code != 'AWAY'group byT1.AWB_Prefix,T1.AWB_No,T1.AWB_Postfix,T1.Rec_ID,T3.Container_Code,T3.Location_Code,T3.UCBFlag--------------------------------------end------------------------------------------------------------------------------------------------------------------------------) X2on X1.运单号 = X2.运单号 and X1.后缀 = X2.后缀-----------begin------------------------end-------------和----------------------------------------begin------------------------end-------------------------------------------之间的语句都可以单独运行,可和在一起是就会显示出错, sql 2008 什么时候取代 sql 2005 SQLSERVER每次重启后,总有一段时间速度非常缓慢 求教!如何用SQL在三个表中查询! SQL2005数据库服务器如何从其他电脑中的ACCESS取数据 救命!!! SQL SERVER连接服务器连接Oracle 怎么样使纵向表变横向表的存储过程? 请问:在SQLserver中,日期型数据如何表示? 行列转换 Sql Server 2000的安装问题,一定给分!(在线等待) “错误14294:请提供@job_id或@job_name来标识作业” delphi程序连接SQL2k的问题,拜托大家了,在线等~ 怎么写SQL语句?
from
(
----------------------------------begin---------------------------------------------------
select
T1.AWB_Prefix + '-' + T1.AWB_No 运单号,
T1.AWB_Postfix 后缀,
T5.Dep 始发站,
T5.Dest 目的站,
sum(T1.Piece) 在站件数,
sum(T4.Piece) 总件数,
T4.SpeCode 特货码
from
TBL_CargoBill T1
inner join
TBL_Cargo_Container T2
on T1.Rec_ID = T2.Rec_ID
inner join
TBL_Container T3
on T3.Container_Code = T2.Container_Code
left outer join
TBL_Cargo_PW T4
on T1.AWB_Prefix = T4.AWB_Prefix and T1.AWB_No = T4.AWB_No and T1.AWB_Postfix = T4.AWB_Postfix
left outer join
TBL_AWB_Basic T5
on T1.AWB_Prefix = T5.AWB_Prefix and T1.AWB_No = T5.AWB_No and T1.AWB_Postfix = T5.AWB_Postfix
where
T1.CargoArr_Flag = 0
and T1.Finish_Flag = 0
and T3.Location_Code != 'SKY'
and T3.Location_Code != 'AWAY'
group by
T1.AWB_Prefix,
T1.AWB_No,
T1.AWB_Postfix,
T5.Dep,
T5.Dest,
T4.SpeCode
--------------------------------------end---------------------------------------------
) X1
left outer join
(
------------------------------------------------------------------------------------
------------------------------------begin--------------------------------------------
select
T1.AWB_Prefix + '-' + T1.AWB_No 运单号,
T1.AWB_Postfix 后缀,
T1.Rec_ID 记录号,
T3.Container_Code 所在容器,
T3.Location_Code 位置,
T3.UCBFlag 容器类别,
sum(T2.Piece) - isnull((select sum(Piece) From TBL_Cargo_Container where Rec_ID = T1.Rec_ID and Container_Code = 'AWAY' group by Rec_ID), 0) 装载货物件数,
sum(T2.Weight) - isnull((select sum(Weight) From TBL_Cargo_Container where Rec_ID = T1.Rec_ID and Container_Code = 'AWAY' group by Rec_ID), 0) 重量
from
TBL_CargoBill T1
inner join
TBL_Cargo_Container T2
on T1.Rec_ID = T2.Rec_ID
inner join
TBL_Container T3
on T3.Container_Code = T2.Container_Code
left outer join
TBL_Cargo_PW T4
on T1.AWB_Prefix = T4.AWB_Prefix and T1.AWB_No = T4.AWB_No and T1.AWB_Postfix = T4.AWB_Postfix
left outer join
TBL_AWB_Basic T5
on T1.AWB_Prefix = T5.AWB_Prefix and T1.AWB_No = T5.AWB_No and T1.AWB_Postfix = T5.AWB_Postfix
where
T1.CargoArr_Flag = 0
and T1.Finish_Flag = 0
and T3.Location_Code != 'SKY'
and T3.Location_Code != 'AWAY'
group by
T1.AWB_Prefix,
T1.AWB_No,
T1.AWB_Postfix,
T1.Rec_ID,
T3.Container_Code,
T3.Location_Code,
T3.UCBFlag
--------------------------------------end----------------------------------------------
--------------------------------------------------------------------------------
) X2
on X1.运单号 = X2.运单号 and X1.后缀 = X2.后缀
-----------begin-------------
-----------end-------------
和
-----------------------------
-----------begin-------------
-----------end-------------
------------------------------
之间的语句都可以单独运行,可和在一起是就会显示出错,