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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Question on multiple Counts

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-03-14 : 09:45:34
I want to create a view that counts records in another table. I want a daily, month to date and Year to date.

Table I'm working with:

ordCount


Ord_Type Ord_no ordDate Prod_Cat
O 2233 20110321 511
O 2244 20110322 511
O 2245 20110323 512


I would like to create a view Counts the number of orders by prod_cat that has:


Ord_Type Prod_Cat DailyCount CountMTD Count YTD
O 511 0 2 6
O 512 0 1 4


MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-03-14 : 13:33:02
Can you provide full sample data as per specified output and explain Daily, Month to Date and Year to Date as per given sample.

Cheers
MIK
Go to Top of Page
   

- Advertisement -