您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
select distinct b.MaterialID,a.id,a.InNo,a.Title,a.FromType,a.FromBillID,d.orderNo ,a.Executor,h.EmployeeName as ExecutorName,a.Processor,e.EmployeeName as ProcessorName ,a.EnterDate,a.projectID,a.totalProduct ,case a.billStatus when '0' then '制单' when '1' then '执行' when '2' then'结单' end as b illStatus ,a.DepId,f.CustName,b.ID as detailID,b.ProductNo,b.ProductName,b.Specification,b.size ,b.unit,b.StorageID,c.StorageName,b.StorageDID,sd.ProductCount,c.StorageDName ,b.ProductCount,b.procedureNO,b.arts,b.RunCard,b.RuncardStatus from officedba.OutSourceInfo a left join officedba.OutSourceDetail b on a.InNo=b.InNo left join officedba.StorageDetailInfo c on c.ID=b.StorageDID and c.StorageNo=b.StorageID left join officedba.PurchaseOrder d on a.FromBillID=d.OrderNO left join officedba.EmployeeInfo e on e.ID=a.Processor left join officedba.ProviderInfo f on f.ID=a.DepId left join officedba.EmployeeInfo h on h.ID=a.Executor left join officedba.ProductInfo i on b.ProductNo=i.ProdNo left join MaterialDetailInfo j on j.MD03=i.ID left join officedba.CodeUnitType cu on cu.ID=b.Unit left join officedba.TechnicsArchives ta on ta.TechNo=b.arts left join officedba.RunCardDetail sd on sd.runcard=b.runcard and sd.ProcedureID=b.procedureNO where a.InNo='CKDBH2017040060'
之前写过一个关联查询和子查询效率对比的博客,流露出自己对关联查询的青睐,如果逻辑足够清晰,关联查询是一个不错的选择。(上面是自己刚写的一个关联查询的sql语句,拿出来晒晒,总觉得有一两米长)
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。