Creating the Query
Let's say, for purposes of our session in this article, that organizational
information consumers are requesting information about the products which our
organization sells. One requirement is for a simple list of products by
category and subcategory. We will provide the SQL that underpins
the report, and then take a look at some of the cosmetics. We will look at other
ways to generate the datasets later, so if you are not an SQL expert, just bear
with me for now.
Type (or cut and paste) the
following basic SQL into the Query pane of the Report Designer.
-- RS002 Basic Practice Example Query
T1.Name AS 'Category',
T2.Name AS 'SubCategory',
T3.Name AS 'Product',
T3.ListPrice AS 'List Price'
ProductSubCategory T2 ON T1.ProductCategoryID =
Product T3 ON T2.ProductSubCategoryID =
The Query pane
appears as shown in Illustration 12.
Click the Run icon in
the toolbar, shown in Illustration 13, to execute the query.
13: The Run Icon
The dataset appears in the Results pane, below the query,
as partially shown in Illustration 14.
14: Results Dataset Appears (Partial View)
We have now defined and tested a simple SQL query. Let's
proceed with the next step of the Authoring process, and design the Layout
of the report.