Board index » delphi » Keep Most Current Duplicate
Tracy McClarnon
![]() Delphi Developer |
Keep Most Current Duplicate2006-10-02 03:45:04 AM delphi150 Hello, I need to write an sql statement that deletes all but the most current duplicate and keep all records where F_TARGET_PRICE>0.00. Duplicates are determined by the following 4 fields: F_PART_NUMBER F_DATE F_PREFIX F_COMPANY I have the following SQL to delete just the duplicates, but any advice to modify it to do the above would be greatly appreciated: Delete From T_OFFERS A Where Not Singular (Select 1 From T_OFFERSB Where ((B.F_PART_NUMBER = A.F_PART_NUMBER) And (B.F_DATE = A.F_DATE) And (B.F_PREFIX = A.F_PREFIX) And And (B.F_COMPANY = A.F_COMPANY))); Thank you, Tracy McClarnon |