Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Personal favorite linked list query

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

select distinct b.MaterialID,a.id,a.InNo,a.Title,a.FromType,a.FromBillID,d.orderNo ,a.Executor,h. Employee Name as ExecutorName,a.Processor,e. Employee Name as ProcessorName ,a.EnterDate,a.projectID,a.totalProduct ,case a.billStatus when '0' then 'document preparation' when '1' then 'execution' when '2' then 'statement' end as b illStatus ,a.DepId,f.CustName,b.ID as detailID,b.ProductNo,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'

I have written a blog about the efficiency of associative queries and subqueries before, showing my preference for associative queries. If the logic is clear enough, associative queries are a good choice. (The above is a sql statement for an associated query that I just wrote. I always feel that it is one or two meters long.)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report