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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you delete the first of two similar (not dupes) record?

Status
Not open for further replies.
Jan 12, 2005
2
US
I have this table (ItemsSold) with 1000 record. It contains these records:

Date Product Type Gallons
1/12/2005 Milk Dairy 4253
1/12/2005 2% Milk Diary 6343
1/13/2005 10% Juice Mix Juices 3245
1/13/2005 10% Juice Mix Juices 3445
1/14/2005 Diet Pepsi Soda 149
1/14/2005 Coke Soda 2934

Notice the product "10% Juice Mix" (4th record) with gallons value error of 3445.

I know for a fact that this record with incorrect gallons value:

1/13/2005 10% Juice Mix Juices 3445

was inserted before this record (correct gallons value):

1/13/2005 10% Juice Mix Juices 3245

Is there a way to identify records with matching Date, Product, and Type, that will delete the record the record that was inserted first? I know how to delete one bad record, but what if I had hundreds of records that were entered with incorrect gallons? I.E. Hundreds of pairs like the example of above. Is there a way to delete all the incorrect records in one fell swoop?

Note: There is no primary key and the presented table above IS the entire table.

Thanks in advance for any help!
 
Nothing in the table can determine which value is wrong. All that is known is that all of the incorrect records were entered first. The correcting records were entered after (that is why there are a pair for every error. I'm kind of hoping there is a way the system can recognize which record (of the pair) was inserted first. (Maybe a system date/time log not seen in the table.) TIA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top