You will definitely want to make a backup before you run this. Maybe even perform this first on your test server to make sure it does what you want. I have tried this on 7 products and 12 variants. The only modifications you would have to make are to change the product ID's. In my example, I'm using my development database product id's of 1,2,3,4,5,6,7.
Code:
DECLARE @DeletePV TABLE
(
rownum int,
variantID int,
productID int
)
INSERT INTO @DeletePV (rownum,VariantID,productID)
(SELECT ROW_NUMBER() OVER (PARTITION BY productID ORDER BY price DESC),
VariantID, ProductID
FROM ProductVariant WHERE ProductID IN (1,2,3,4,5,6,7) AND Published = 1 AND Deleted = 0
)
--DELETE FROM ProductVariant WHERE variantID IN (SELECT VariantID FROM @DeletePV WHERE rownum > 1)
** I commented out the DELETE line to make sure you know what you are doing before you run the delete command. Feel free to ask if you have any questions.