SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Do I need WHERE clause here?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rv498
Yak Posting Veteran

USA
60 Posts

Posted - 03/18/2014 :  17:02:01  Show Profile  Reply with Quote
List the amount of the total sales of reseller sales by business type.
-- First find the business type to determine you have them all. Then create your query.
-- 3 Rows

I'm not sure how to translate 'First find the business type' to SQL code.

SELECT SUM(ROUND(S.[OrderQuantity] * S.UnitPrice, 2)) AS TotalSales
FROM dbo.DimReseller AS R
INNER JOIN dbo.FactResellerSales AS S
ON R.ResellerKey = S.ResellerKey

tkizer
Almighty SQL Goddess

USA
37134 Posts

Posted - 03/18/2014 :  17:05:52  Show Profile  Visit tkizer's Homepage  Reply with Quote
They want you to use a GROUP BY with business type.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 03/18/2014 :  17:06:35  Show Profile  Reply with Quote
I think they mean that you need to show the total sales for each business type. So you need to add the business type as a column in the select list. When you do that, it will also require that you add that column in the GROUP BY clause.
Go to Top of Page

rv498
Yak Posting Veteran

USA
60 Posts

Posted - 03/18/2014 :  21:47:47  Show Profile  Reply with Quote
SELECT R.BusinessType, SUM(R.AnnualSales) AS TotalSales
FROM dbo.DimReseller AS R
GROUP BY R.BusinessType

I believe this is correct.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000