是否可以使用查询更改结果集中记录/组的顺序GROUP BY
?
我有这个查询:
SELECT Category,
Subcategory,
ProductName,
CreatedDate,
Sales
FROM TableCategory tc INNER JOIN
TableSubCategory ts ON tc.col1 = ts.col2 INNER JOIN
TableProductName tp ON ts.col2 = tp.col3
GROUP BY Category,
SubCategory,
ProductName,
CreatedDate,
Sales
现在,我正在创建一个 SSRS 报告,其中Category
主要行组,然后SubCategory
是其子行组。然后ProductName
是主列组。
[截图链接断开:http://www.(freeimagehosting).net/uploads/8035123725.jpg]
它工作得很好,但它ProductNames
按字母顺序显示。我希望它显示ProductNames
自定义顺序(由我定义),例如:
ProductNo5 in 3rd column,
ProductNo8 in 4th column,
ProductNo1 in 5th column
... and so on!