Saturday, February 25, 2012

Q: write this query

Hello,
I have table T1 and F1, F2, F3, F4 and F5, and a Count field
Now I need to write a query that groups by fields and returns sum of count
for each field such as
F1, Sum(Count)ForF1,F2, Sum(Count)ForF2, â?¦F5, Sum(Count)ForF5
How can I do this?On Wed, 19 Apr 2006 08:15:03 -0700, JIM.H. wrote:
>Hello,
>I have table T1 and F1, F2, F3, F4 and F5, and a Count field
>Now I need to write a query that groups by fields and returns sum of count
>for each field such as
>F1, Sum(Count)ForF1,F2, Sum(Count)ForF2, ?F5, Sum(Count)ForF5
>How can I do this?
>
Hi Jim,
It's not clear what you need exactly. Can you post the table structure
(as CREATE TABLE statement, including constraints, properties and
indexes), some rows of sample data (as INSERT statements) and expected
results?
--
Hugo Kornelis, SQL Server MVP

No comments:

Post a Comment