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 |
|
andrewcw
Posting Yak Master
133 Posts |
Posted - 2009-09-03 : 22:32:45
|
I have a complex query that returns something likeCustomer ItemsInOrderJack 10Jack 12Ben 6If the table already existed -I would use quote: Select Customer,Count(ItemsInOder) as NumOrdersfrom TableA Group By Customer
To get count of Number of Orders for Jack & BenHowever in this case I dont understand how to wrap this structurearound the query that's returning the results Select Customer,Count(ItemsInOder) as NumOrdersfrom [Select .... group by ]Group By CustomerIdeas ?? Thanksandrewcw |
|
|
andrewcw
Posting Yak Master
133 Posts |
Posted - 2009-09-03 : 22:59:29
|
| OK I think I got an idea from someone elses question Select D.Customer,Count(ItemsInOder) as NumOrdersfrom [Select .... group by ] as DGroup By Customerandrewcw |
 |
|
|
|
|
|