I got a table that looks like this:

ACCOUNT---------NAME------------BROUTE------------BACCOUNT-----------VALUE ---NEED
111111................BILL...............77777777...............88888888...............345.34--
222222................BOB...............77777777...............88888888...............0.0--------
111111................BILL...............77777777...............88888888...............454.34------2225.67
111111................BILL...............77777777...............88888888...............657.67----
222222................BOB...............77777777...............88888888...............768.32--

444444................JIM...............55555555...............66666666...............23.12----
333333................TIM...............55555555...............66666666...............36.58-------685.02
333333................TIM...............55555555...............66666666...............625.32---

There are over 62 thousand entries with different values for columns listed above.
I want to use (BROUTE + BACCOUNT) as a primary key for this query. "Bank account + bank routing number"
I need to get the sum of the VALUE where (BROUTE + BACCOUNT) are the same.
Any help would be great!!

Hi,

Try this:
SELECT CONVERT(varchar, BROUTE) + ' ' + CONVERT(varchar, BACCOUNT) AS [Group], SUM([VALUE]) AS Total
FROM tblExample
GROUP BY CONVERT(varchar, BROUTE) + ' ' + CONVERT(varchar, BACCOUNT)

Hope this works for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.