我正在从保存的视图中从 SQL Server 导出到 Excel。在该视图中,它按两列排序(按..排序)
但是当我导出它时,它在 Excel 中是随机排序的。
如何使用订单导出?
这是视图的查询:
SELECT TOP (100) PERCENT GETDATE() AS Date, MixStatusID AS Partner, SUM(CAST(Weight AS
float)) AS Weight, SUM(CAST(TotalCostPrice AS float)) AS TotalCost, ProductGroupID
FROM dbo.D_ParcelLocation
WHERE (ParcelStatusID IN (N'stock', N'memo', N'transfer', N'analyze_un')) AND (ParcelTypeID <> N'M') AND (ProductGroupID <> N'G_POL') AND (ProductGroupID <> N'G_ROU')
GROUP BY MixStatusID, ProductGroupID
HAVING (SUM(CAST(Weight AS float)) > 0)
ORDER BY ProductGroupID, Partner