Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

Yak Posting Veteran

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

Almighty SQL Goddess

38200 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
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 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

Yak Posting Veteran

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  
 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.02 seconds. Powered By: Snitz Forums 2000