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
 SQL Server Development (2000)
 Duplicate Values with an addition problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-09 : 01:03:41
John writes "I've searched and looked at your answer to the posted question of removing duplicate records, which answer's half of my question. But, my problem is that I have records with duplicate values in my field of 'acctid' and other related fields with other duplicate values and unique values which define which rows of data I need to keep or delete. For example:

My fields are:

'acctid'   'tradate'    'transno1'
1 20000501 5
1 20000501 4
1 20000430 3



I need to keep the first row of data with the transno1 = 5 because this is the most recent record. Can you give me a solultion or any help to this problem where I have fields with duplicate values but need to keep the row of data which is most current?

If you could offer me any help, I'd really appreciate it.

Thanks,
John"
   

- Advertisement -