"DocNo": "DAIKIN21120002", "OrderNo":"L211200001", "Supplier":"顺丰快递",
时间: 2024-06-16 22:01:36 浏览: 173
根据您提供的信息,"DocNo" 是文档编号,这里为 "DAIKIN21120002",可能是DAIKIN(一家公司或产品系列)在2021年12月期间的一份文件或订单号。"OrderNo" 是订单编号,这里是 "L211200001",表明这是一份2021年12月的订单,可能与前面的 "DocNo" 指向同一笔交易。
"Supplier" 表示供应商,这里是 "顺丰快递",这意味着这份订单的承运商是顺丰快递。这些信息通常在物流或采购系统中用于跟踪和管理订单。
相关问题
UPDATE mo_mo SET Project = ( SELECT id FROM CBO_Project WHERE code = SUBSTRING(ProductLotNo, 1, 6) ) WHERE DocNo IN (SELECT DocNo FROM mo_mo WHERE Project IS NULL);
这是一条 MySQL 数据库的更新语句。它的意思是,更新 mo_mo 表中的 Project 字段,将其设置为 CBO_Project 表中 code 字段等于 mo_mo 表中 ProductLotNo 字段前 6 位的记录的 id 字段。只有 mo_mo 表中的 DocNo 字段在满足 Project 为空的记录中时才进行更新。
select c.PurchaseNo as DocNo,c.PurchaseDate as DocDate,'' as 'User' ,'采购入库' as 'OperationType',c.Remark,c.Creator,c.CreateDate from It_Equip a join It_PurchaseInList b on a.EquipId=b.EquipId join It_PurchaseIn c on b.PurchaseId=c.PurchaseId where a.FixedNo='CCID-BB-BJB-23058' union select c.ReceiveNo as DocNo,c.ReceiveDate as DocDate,c.Custodian as 'User' ,'资产领用' as 'OperationType',c.Remark,c.Creator,c.CreateDate from It_Equip a join It_GoodsReceiveList b on a.EquipId=b.EquipId join It_GoodsReceive c on b.ReceiveId=c.ReceiveId where a.FixedNo='CCID-BB-BJB-23058' union select c.BackNo as DocNo,c.BackDate as DocDate,c.Applicant as 'User','资产退库' as 'OperationType',c.Remark,c.Creator,c.CreateDate from It_Equip a join It_GoodsBackList b on a.EquipId=b.EquipId join It_GoodsBack c on b.BackId=c.BackId where a.FixedNo='CCID-BB-BJB-23058' union select c.ScrapNo as DocNo,c.ScrapDate as DocDate,c.Applicant as 'User', '资产报废' as 'OperationType',c.Remark,c.Creator,c.CreateDate from It_Equip a join It_GoodsScrapList b on a.EquipId=b.EquipId join It_GoodsScrap c on b.ScrapId=c.ScrapId where a.FixedNo='CCID-BB-BJB-23058' union select b.ChangeNo as DocNo,b.RegDate as DocDate,b.CustodianAfter as 'User','资产变更' as 'OperationType',b.Remark,b.Creator,b.CreateDate from It_Equip a join It_GoodsChange b on a.EquipId=b.EquipId where a.FixedNo='CCID-BB-BJB-23058' 优化sql语句
可以考虑使用UNION ALL代替UNION,因为UNION会去重,而UNION ALL不会去重,从而减少了查询的开销。同时,可以使用子查询来减少重复的代码。优化后的SQL语句如下:
SELECT DocNo, DocDate, User, OperationType, Remark, Creator, CreateDate
FROM (
SELECT c.PurchaseNo AS DocNo, c.PurchaseDate AS DocDate, '' AS User, '采购入库' AS OperationType, c.Remark, c.Creator, c.CreateDate
FROM It_Equip a
JOIN It_PurchaseInList b ON a.EquipId = b.EquipId
JOIN It_PurchaseIn c ON b.PurchaseId = c.PurchaseId
WHERE a.FixedNo = 'CCID-BB-BJB-23058'
UNION ALL
SELECT c.ReceiveNo AS DocNo, c.ReceiveDate AS DocDate, c.Custodian AS User, '资产领用' AS OperationType, c.Remark, c.Creator, c.CreateDate
FROM It_Equip a
JOIN It_GoodsReceiveList b ON a.EquipId = b.EquipId
JOIN It_GoodsReceive c ON b.ReceiveId = c.ReceiveId
WHERE a.FixedNo = 'CCID-BB-BJB-23058'
UNION ALL
SELECT c.BackNo AS DocNo, c.BackDate AS DocDate, c.Applicant AS User, '资产退库' AS OperationType, c.Remark, c.Creator, c.CreateDate
FROM It_Equip a
JOIN It_GoodsBackList b ON a.EquipId = b.EquipId
JOIN It_GoodsBack c ON b.BackId = c.BackId
WHERE a.FixedNo = 'CCID-BB-BJB-23058'
UNION ALL
SELECT c.ScrapNo AS DocNo, c.ScrapDate AS DocDate, c.Applicant AS User, '资产报废' AS OperationType, c.Remark, c.Creator, c.CreateDate
FROM It_Equip a
JOIN It_GoodsScrapList b ON a.EquipId = b.EquipId
JOIN It_GoodsScrap c ON b.ScrapId = c.ScrapId
WHERE a.FixedNo = 'CCID-BB-BJB-23058'
UNION ALL
SELECT b.ChangeNo AS DocNo, b.RegDate AS DocDate, b.CustodianAfter AS User, '资产变更' AS OperationType, b.Remark, b.Creator, b.CreateDate
FROM It_Equip a
JOIN It_GoodsChange b ON a.EquipId = b.EquipId
WHERE a.FixedNo = 'CCID-BB-BJB-23058'
) AS t
ORDER BY DocDate DESC, DocNo DESC
阅读全文