<Query>
<DataSourceName>AdventureWorks</DataSourceName>//指定数据源名称
<CommandText>SELECT ProductCategory.Name AS ProdCat, //产品类别ProductSubCategory.Name AS SubCat, //产品子类别
DATEPART(yy, SalesOrderHeader.OrderDate) AS OrderYear, //年份
''''Q'''' + DATENAME(qq, SalesOrderHeader.OrderDate) AS OrderQtr, //季度SUM(SalesOrderDetail.UnitPrice * SalesOrderDetail.OrderQty) AS Sales//销售数据
FROM ProductSubCategory INNER JOIN
………………….
WHERE (SalesOrderHeader.OrderDate BETWEEN ''''1/1/2002'''' AND ''''12/31/2003'''')//时间范围
//这里的GROUP BY保证数据的层次关系
GROUP BY
DATEPART(yy, SalesOrderHeader.OrderDate), ProductCategory.Name, ProductSubCategory.Name, ''''Q'''' + DATENAME(qq,
SalesOrderHeader.OrderDate), ProductSubCategory.ProductSubCategoryID</CommandText>
下面再来看看rdl中是如何指定季度列隐藏在年份下面的
<ColumnGrouping>
<DynamicColumns>
<Grouping Name="OrderQtr">//该动态列的名称为OrderQtr
<GroupExpressions>
上一页 [1] [2] [3] [4] 下一页 |