edojan
Dec 11 2008, 12:56 PM
Hi Guys,
Having a brain fart cant figure this out this morning.
Here is table i Have:
CustomerID (unique PK)
VendorID
SaleDate
There are few million records, I need to find duplicate billings same Vendor ID and witing 2 Days of SaleDate. basically select all records that have unique custID, same VendorID and almost same SaqleDate (within 2 days).
how do i do this?
Thanks!
Ender
Dec 11 2008, 01:09 PM
There is no command to do a group by on "almost the same sales date" with sql. However, it probably could be done with code. You would just create a basic select and then order by the 3 fields you give above, then you would process one record at a time and compare it to the previous record. You could then write out all potential duplicates to another table. Note: for a few million records this could take a bit. Anyone else have any other ideas?