Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rv498
Yak Posting Veteran
60 Posts |
Posted - 2014-03-18 : 17:02:01
|
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 RowsI'm not sure how to translate 'First find the business type' to SQL code.SELECT SUM(ROUND(S.[OrderQuantity] * S.UnitPrice, 2)) AS TotalSalesFROM dbo.DimReseller AS RINNER JOIN dbo.FactResellerSales AS SON R.ResellerKey = S.ResellerKey |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-03-18 : 17:05:52
|
They want you to use a GROUP BY with business type.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-03-18 : 17:06:35
|
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. |
|
|
rv498
Yak Posting Veteran
60 Posts |
Posted - 2014-03-18 : 21:47:47
|
SELECT R.BusinessType, SUM(R.AnnualSales) AS TotalSalesFROM dbo.DimReseller AS RGROUP BY R.BusinessTypeI believe this is correct. |
|
|
|
|
|