Documente Academic
Documente Profesional
Documente Cultură
SELECT
soh.OrderDateAS[Date],
soh.SalesOrderNumberAS[Order],
pps.NameASSubcat,pp.NameasProduct,
SUM(sd.OrderQty)ASQty,
SUM(sd.LineTotal)ASLineTotal
FROMSales.SalesPersonsp
INNERJOINSales.SalesOrderHeaderASsoh
ONsp.BusinessEntityID=soh.SalesPersonID
INNERJOINSales.SalesOrderDetailASsd
ONsd.SalesOrderID=soh.SalesOrderID
INNERJOINProduction.ProductASpp
ONsd.ProductID=pp.ProductID
INNERJOINProduction.ProductSubcategoryASpps
ONpp.ProductSubcategoryID=pps.ProductSubcategoryID
INNERJOINProduction.ProductCategoryASppc
ONppc.ProductCategoryID=pps.ProductCategoryID
GROUPBYppc.Name,soh.OrderDate,soh.SalesOrderNumber,pps.Name,pp.Name,
soh.SalesPersonID
HAVINGppc.Name='Clothing'
7. Optional Click the Query Designer button. The query is displayed in the textbased query designer. You can toggle to
the graphical query designer by clicking Edit As Text. View the results of the query by clicking the run
query designer toolbar.
button on the
You see the data from six fields from four different tables in the AdventureWorks2014 database. The query makes use of
TransactSQL functionality such as aliases. For example, the SalesOrderHeader table is called soh.
8. Click OK to exit the query designer.
9. Click OK to exit the Dataset Properties dialog box.
Your AdventureWorksDataset dataset and fields appear in the Report Data pane.
Next Task
You have successfully specified a query that retrieves data for your report. Next, you will create the report layout. See Lesson 4:
Adding a Table to the Report Reporting Services.
See Also
Query Design Tools SSRS
SQL Server Connection Type SSRS
Tutorial: Writing TransactSQL Statements
Community Additions
Spotted a typo
4. Select the data souce you created in the previous lesson,
AdventureWorks2014
.
2016 Microsoft