打印本文 打印本文 关闭窗口 关闭窗口
微软SQL Server 2000 Reporting Services介绍(五)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3398  更新时间:2007/11/14 11:01:48  文章录入:mintao  责任编辑:mintao
    <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]  下一页

打印本文 打印本文 关闭窗口 关闭窗口