Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Find Duplicates and then sum the value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-12 : 21:50:21
Tina writes "There is a Stored Procedure, which extracts the data from lot of tables. Need to find the duplicates.. like two same SSN [Social Security Numbers] .If found , then add their dollar amounts]. Like their deduction amounts."

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-12 : 21:52:49
[code]
select SSN, sum([deduction_amounts])
from yourtable
group by SSN
having count(*) > 1
[/code]


KH

Go to Top of Page
   

- Advertisement -