Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

Posted Feb 26, 2004

MSSQL Server Reporting Services: The Authoring Phase: Overview Part I - Page 6

By William Pearson

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.

1.  Type (or cut and paste) the following basic SQL into the Query pane of the Report Designer.


-- RS002  Basic Practice Example Query
SELECT
    T1.Name AS 'Category', 
        T2.Name AS 'SubCategory', 
        T3.Name AS 'Product', 
        T3.ListPrice AS 'List Price'
FROM
    ProductCategory T1
INNER JOIN
    ProductSubCategory T2 ON T1.ProductCategoryID = 
        T2.ProductCategoryID
INNER JOIN
    Product T3 ON T2.ProductSubCategoryID = 
        T3.ProductSubCategoryID;

The Query pane appears as shown in Illustration 12.

Click for larger image

Illustration 12: SQL Query in the SQL Pane

2.  Click the Run icon in the toolbar, shown in Illustration 13, to execute the query.


Illustration 13: The Run Icon

The dataset appears in the Results pane, below the query, as partially shown in Illustration 14.


Illustration 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.



MS SQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM