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 |
sridhar3004
Starting Member
34 Posts |
Posted - 2011-01-31 : 00:06:34
|
I've the following dataProductMasterP1P2P3CategoryMaster1 P1 c12 P1 c23 P2 c14 P2 c25 P3 c16 P3 c2TicketMasterID CategoryMaterID Status1 1 Open2 2 Closed3 3 PendingI want an output that gives me productwise, categorywise, count of statusesIn the example I mentioned above, the output will beProduct 1Category 1Open Closed Pending 1 0 0Category 2Open Closed Pending 1 0 0and so on......Any answers will be highly appreciated |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-15 : 15:14:40
|
I want an output that gives me productwise, categorywise, count of statusesSelect Product.productID,Category.CategoryID,count(OtherTable.Statuses) as CountOfStatusesFrom Product Inner join Category on Product.ProductId=Category.CategoryIDInner join otherTable on OtherTable.CategoryId=Category.CategoryIDGroup by Product.productID,Category.CategoryID |
|
|
|
|
|