标签:mac log port 时间 trade name rod mst HERE
--包裹单号 入库时间 交易号 商品分类 商品名称 实付款
SELECT a.DeliveryCode AS ‘包裹单号‘,a.DomesticWarehouseInTime AS ‘入库时间‘,a.TradeOrderID AS ‘交易号‘,
(SELECT TOP 1 CatalogName FROM [dbo].[TBD_ProductCatalog] WHERE CatalogID=b.ProductCatalogID AND (CatalogName<>NULL OR CatalogName<>‘‘) ) AS ‘分类名称‘,
b.ProductName AS ‘产品名称‘,b.ProductCatalogName AS ‘商品名称‘,b.TotalItemActualPrice AS ‘总价‘ INTO #tempTable
FROM dbo.TWX_TransportFromMst a WITH (NOLOCK)
JOIN dbo.TWX_TransportFromDtl b WITH (NOLOCK) ON a.TransportFormMstID=b.TransportFormMstID
WHERE a.DeliveryCode IN
(
)
SELECT 包裹单号,入库时间,交易号,SUM(总价) AS ‘总价‘,
(SELECT BB.分类名称+‘,‘ FROM #tempTable BB WHERE BB.包裹单号=AA.包裹单号 FOR XML PATH(‘‘)) AS ‘分类名称‘,
(SELECT BB.商品名称+‘,‘ FROM #tempTable BB WHERE BB.包裹单号=AA.包裹单号 FOR XML PATH(‘‘)) AS ‘商品名称‘,
(SELECT BB.产品名称+‘,‘ FROM #tempTable BB WHERE BB.包裹单号=AA.包裹单号 FOR XML PATH(‘‘)) AS ‘产品名称‘
FROM #tempTable AA
GROUP BY 包裹单号,入库时间,交易号
DROP TABLE #tempTable
标签:mac log port 时间 trade name rod mst HERE
原文地址:https://www.cnblogs.com/chengjun/p/9001349.html