Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Need all activity by product code even if it's empty. Expand / Collapse
Author
Message
Posted Wednesday, November 6, 2013 6:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, September 9, 2014 8:28 AM
Points: 6, Visits: 18
I also included the select query that works as needed until I use the WHERE clause with dates. Excuse my ignorance but not sure what else you mean.
Post #1511857
Posted Wednesday, November 6, 2013 9:42 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 12:38 AM
Points: 360, Visits: 1,526
rlindstrom 38273 (11/6/2013)
I also included the select query that works as needed until I use the WHERE clause with dates. Excuse my ignorance but not sure what else you mean.


Click on the link under my signature line on the correct way to post questions. That article will explain DDL, Insert Statements, etc . . .


__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1511927
Posted Wednesday, November 13, 2013 4:36 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 3:18 AM
Points: 177, Visits: 418
Hi -
I think I am right in saying that you are trying to display the Product Class and Months of sales - but you may not have sales in that period - so wish to show a ZERO.

You may require to create a Year/Month Reference Table with the product class - using this as the LEFT table - Join to the details table

Select ProductClass, Year, Month, SUM( ProductClass_SalesValue )
from DateProductClassTable as aa
Left outer join ProductClassDetails as bb
on aa.productClass = bb.productClass
group by ProductClass, Year, Month

Does this help or understand the problem ?


________________________________________________________________________________________________
Regards
Steve
SQL 2008 DBA/DBD - MCTS/MCITP

Please don't trust me, test the solutions I give you before using them.
Post #1513801
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse