Skip to content
Advertisement

Combine data with same ID

I have an assignment where I need to use aggregate functions in the queries. I keep running into a problem where there are multiply entries for the same ID, and I would rather them be combined into one run (added together for the same ID).

Output below (IDs to be combined in column 3, “intTeamandClubID”):

I want the “intTeamandClubID” to be 1 row for the same ID, and the “TotalPledge” to be added together.

Advertisement

Answer

You can remove the DISTINCT in the SELECT clause and the column TEGS.monPledgeAmount in the GROUP BY clause.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement