0

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!!

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by kb.net
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.