DELETE FROM v5_shops WHERE id NOT IN ( SELECT t.id FROM ( SELECT MIN(id) AS id FROM v5_shops GROUP BY `shop_no` ) t )