Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have a question regarding du

Status
Not open for further replies.

mptwoadmin

Programmer
May 15, 2006
46
US
Hi,
I have a question regarding duplicate data entries. I would like to zero out all duplicate entries of '62945' but machine2 on Nov 18 2009. Is this possible? And how would you go about this?

date_id machine1 machine2 machine3
Nov 18 2009 12:00AM 62945 62945 53214
Nov 19 2009 12:00AM 62945 62945 62945
Nov 20 2009 12:00AM 62945 62945 62945
Nov 21 2009 12:00AM 62945 62945 62945
Nov 22 2009 12:00AM 62945 62945 62945
Nov 23 2009 12:00AM 62945 62945 62945
Nov 24 2009 12:00AM 62945 62945 62945


Thank You
 
You simply need something unique to attach to for your query. Normally this is an ID, but a date works just as well.

Code:
--Verify your filter criteria
SELECT * FROM yourTable
where Machine2 = '62945' AND date_id <> '2009-11-18'

--IF Correct
DELETE yourTable
where Machine2 = '62945' AND date_id <> '2009-11-18'

Lodlaiden



You've got questions and source code. We want both!
Oh? That? That's not an important password. - IT Security Admin (pw on whiteboard)
 
Hi, Your qry removes all entires for 'Nov 18 2009 12:00AM'. I need all entries for '62945' to be zero'd out but machine2 on 'Nov 18 2009 12:00AM'

Thank You.
 
This would remove ALL entries for machine2='62945' EXCEPT any entries on 11/18/2009

Are you saying that you have multiple entries for for "some" machine id on a single date, and need duplicates of those removed?
Except any duplicates for machine2 = 62945 on 11/18/2009?
Your sample set did not indicate that.

Could you provide a better "before/after" sample of what you're trying to accomplish?

Lodlaiden

You've got questions and source code. We want both!
Oh? That? That's not an important password. - IT Security Admin (pw on whiteboard)
 
What defines you records as "duplicate"?
Why these records are duplicate?
[tt]
date_id machine1 machine2 machine3
Nov 18 2009 12:00AM 62945 62945 53214
Nov 19 2009 12:00AM 62945 62945 62945
[/tt]

Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top