相关联的表,除了主键外其它相关处理(商品信息).a.BillNo=e.SrcBillNo and d.ProductCode=e.ProductCode and d.ProductSortCode=e.ProductSortCode

原创 2007年09月15日 11:55:00
/*------------------------------------------------
 创建时间:2007-09-13
 创 建 人:szj
 参  考:
 功  能: 门店订货单执行明细表(仓库调拨单和加盟配送单)
 修  改: 
 具  体:
 备  注:
*/-------------------------------------------------
select a.BillNo,a.TheDate,e.*,b.TheName StorageName,b.ShopName,b.StorPlaceName,c.TheName ProductName,c.ConfigName,c.UnitName,
d.ProductCode,d.ProductSortCode,d.Number OrderNumber,d.DeliverDate
from tbSelfOrder a
left outer join tbSelfOrderItem d on a.BillNo=d.BillNo
left outer join
(
--仓库调拨单
select cc.ProductCode,cc.ProductSortCode,SrcBillNo,dd.BillNo RedeployNo,dd.ConfirmDate,dd.TheDate RedeployDate,sum(cc.Number) SureNumber,cc.RedeployInStorage,cc.RedeployInPlace
from tbStorRedeployItem cc
left outer join tbStorRedeploy dd on cc.BillNo = dd.BillNo
where dbo.GetByteToBoolean(dd.TheState,0x0001)=1 and dd.SrcBillSort = 1
group by cc.ProductCode,cc.ProductSortCode,cc.SrcBillNo,dd.BillNo,dd.ConfirmDate,dd.TheDate,cc.RedeployInStorage,cc.RedeployInPlace
union all
--加盟配送单
select cc.ProductCode,cc.ProductSortCode,SrcBillNo,dd.BillNo RedeployNo,dd.ConfirmDate,dd.TheDate RedeployDate,sum(cc.Number) SureNumber,cc.RedeployInStorage,cc.RedeployInPlace
from tbStorRedeployLeagueItem cc
left outer join tbStorRedeployLeague dd on cc.BillNo = dd.BillNo
where dbo.GetByteToBoolean(dd.TheState,0x0001)=1 and dd.SrcBillSort = 1
group by cc.ProductCode,cc.ProductSortCode,cc.SrcBillNo,dd.BillNo,dd.ConfirmDate,dd.TheDate,cc.RedeployInStorage,cc.RedeployInPlace
)e on a.BillNo=e.SrcBillNo and d.ProductCode=e.ProductCode and d.ProductSortCode=e.ProductSortCode
--辅助信息
left outer join vDatumStorPlace b on e.RedeployInStorage = b.TheCode and e.RedeployInPlace = b.StorPlaceCode
left outer join vDatumProduct c on d.ProductCode = c.TheCode and d.ProductSortCode = c.ProductSort
where dbo.GetByteToBoolean(a.TheState,0x0001)=1 and e.RedeployInStorage in {{StorageGroup}}  {0} 

相关文章推荐

UVA - 11175 From D to E and Back

点击打开题目链接 From D to E and BackDescriptionTake any directed graph D with n vertices and m edges. You ...

This node has namespaceId '1902198261 and clusterId 'CID-0ce44319-7032-49ec-83e5-4df0782a0d4e' but t

Response message: This node has namespaceId '1902198261 and clusterId 'CID-0ce44319-7032-49ec-83e5-4...

Codeforces Round #353 (Div. 2) E. Trains and Statistic(求d[i][j]的和的最小值(1<=i<=n,i+1<=j<=n))

E. Trains and Statistic Vasya commutes by train every day. There are n train stations in the city, a...

51nod1503 猪和回文&&codeforces 570E Pig and Palindromes&&洛谷夏令营模拟赛D1T2

E. Pig and Palindromes time limit per test 4 seconds memory limit per test 256 megabytes...

UVa 11175:From D to E and back(图论)

题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=845&page=show_pr...

UVa - 11175 - From D to E and Back

Take any directed graph D with n vertices and m edges. You can make the Lying graph E of D in the fo...

Codeforces Round #396(Div. 2)E. Mahmoud and a xor trip【二进制拆位+Dfs处理】

E. Mahmoud and a xor trip time limit per test 2 seconds memory limit per test 256 megabytes ...

3D展示商品信息

  • 2016年03月15日 14:53
  • 77KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:相关联的表,除了主键外其它相关处理(商品信息).a.BillNo=e.SrcBillNo and d.ProductCode=e.ProductCode and d.ProductSortCode=e.ProductSortCode
举报原因:
原因补充:

(最多只允许输入30个字)