Query sum and group by

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Query sum and group by

Post by sal21 »

Have this table:

F1 T
A. 6
A. 3
A. 5
B. 4

I Need a SQL.

Ho to group by F1 and sun the related value in T?

To the end:
A. 14
B. 4

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Query sum and group by

Post by HansV »

SELECT F1, Sum(T) AS SummaDiT FROM NomeDaTavola GROUP BY F1
Last edited by HansV on 25 Mar 2024, 08:10, edited 1 time in total.
Reason: to correct typo
Best wishes,
Hans

EileenStifone
NewLounger
Posts: 10
Joined: 16 Aug 2022, 05:39

Re: Query sum and group by

Post by EileenStifone »

SELECT F1, Sum(T) AS SummaDiT FROM NomeDaTavola GROUP BY F1

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Query sum and group by

Post by HansV »

Thanks for the correction! I will change my previous reply.
Best wishes,
Hans