我使用SSAS
和SQL Server 2008R2
我使用AdventureWorkDW维度数据库。
我写这个查询:
Select
[Measures].[Internet Sales Amount] on columns,
order(
[Product].[Product Categories].[Subcategory],
[Measures].[Internet Sales Amount],
asc
) on rows
From [Adventure Works]
我得到了这样的结果:
我也写这个查询:
Select
[Measures].[Internet Sales Amount] on columns,
non empty order(
crossjoin(
[Product].[Category].[Category],
[Product].[Subcategory].[Subcategory]
),
[Measures].[Internet Sales Amount],
desc
) on rows
From [Adventure Works]
结果也没有排序:
为什么结果没有排序?
答案 0 :(得分:1)
查询(2012sql):
Select
[Measures].[Internet Sales Amount] on columns,
order(
[Product].[Product Categories].[Subcategory],
[Measures].[Internet Sales Amount],
basc
) on rows
From [Adventure Works]
问题是我认为是因为数据was hierarchical and with basc
只是按金额排序。
Order函数可以是分层的(使用时指定) ASC或DESC标志)或非分层(通过使用 BASC或BDESC标志
结果(2012sql):
| GG | INTERNET SALES AMOUNT |
|-------------------|-----------------------|
| Lights | (null) |
| Locks | (null) |
| Panniers | (null) |
| Pumps | (null) |
| Bib-Shorts | (null) |
| Tights | (null) |
| Bottom Brackets | (null) |
| Brakes | (null) |
| Chains | (null) |
| Cranksets | (null) |
| Derailleurs | (null) |
| Forks | (null) |
| Handlebars | (null) |
| Headsets | (null) |
| Mountain Frames | (null) |
| Pedals | (null) |
| Road Frames | (null) |
| Saddles | (null) |
| Touring Frames | (null) |
| Wheels | (null) |
| Socks | $5,106.32 |
| Cleaners | $7,218.60 |
| Caps | $19,688.10 |
| Gloves | $35,020.70 |
| Vests | $35,687.00 |
| Bike Racks | $39,360.00 |
| Bike Stands | $39,591.00 |
| Hydration Packs | $40,307.67 |
| Fenders | $46,619.58 |
| Bottles and Cages | $56,798.19 |
| Shorts | $71,319.81 |
| Jerseys | $172,950.68 |
| Helmets | $225,335.60 |
| Tires and Tubes | $245,529.32 |
| Touring Bikes | $3,844,801.05 |
| Mountain Bikes | $9,952,759.56 |
| Road Bikes | $14,520,584.04 |