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)
 Another duplicate flagging

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-10 : 08:05:22
chuck brown writes "This deals with deleting sortof duplicates in a GoldMine table, so all I want to do is put a flag in a column for records that I want to delete, then let a GoldMine process do the deleting, so I don't miss any associated record changes that might need to be made. That being said...

I have a table (CONTACT1) with numerous columns. If there is more than one record for a particular COMPANY, CONTACT combination, and the SOURCE column = 'ACTIMP', then I want to set KEY5 = 'KILL'.

Can you help me?

Thanks"

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-09-10 : 08:11:57
[CODE]
UPDATE CONTACT1
SET KEY5 = 'KILL'
WHERE EXISTS (SELECT 1
FROM CONTACT1 AS A
WHERE A.COMPANY = CONTACT1.COMPANY
AND A.CONTACT = CONTACT1.CONTACT

GROUP BY COMPANY, CONTACT
HAVING COUNT(*) > 1)
AND SOURCE = 'ACTIMP'
[/CODE]

A primary key would be a better substitute to be honest.
__________________
Make love not war!
Go to Top of Page
   

- Advertisement -