DELETE t1 FROM subscriptions t1 INNER JOIN subscriptions t2 WHERE t1.id < t2.id AND t1.user_id = t2.user_id AND t1.name = t2.name