Reputation: 275
I'm a new to SQL Server, and have to import this data into a table:
I want to show me this data:
942,4600
952,4000
For that purpose I wrote this SQL statement:
SELECT
SUM(SQ.[price])
FROM
(SELECT DISTINCT
[sycle] as TRACK, [price]
FROM
[ClubEatc].[dbo].[testTABLE]) SQ
That query sums all sycle
prices, but I want sum per sycle
. How can I implement this? Thanks.
Upvotes: 0
Views: 41
Reputation: 14689
Just Group by SQ.sycle:
It will set group of each unique sycle and do some of it's price.
SELECT
SQ.sycle,
SUM(SQ.[price]) AS Price
FROM TableName SQ
Group By SQ.sycle
Upvotes: 1