Hi,
I'm writing a Coldfusion page to perform some DB cleanup. I'm needing some assistance with a query. ID is the Primary key Int field with no duplicates. Updated is a bit field 1 or 0. Vend_ID is a number. The rest are Varchar fields.
SELECT ID, Vend_ID, Comp, Zip_Code, Type, Work, Updated
FROM Vend_Comp
WHERE (Type = 'Poly') AND (Work = 'Second') AND (Zip_Code = 12345)
Now that park works fine. What I need is something to handle the returned records. I need to loop through results and select any with duplicate Vend_ID. Then delete the ones with the lower ID numbers.
Perhaps a sub query to pull out the one with duplicate Vend_ID... then a query to get Max(ID) and delete the ones <> to Max(ID)? Hmmmm...