SELECT
  slug,
  group_concat(DISTINCT id),
  group_concat(DISTINCT name),
  count(id) AS conto
FROM ProductSize
GROUP BY slug
HAVING conto > 1;

select productSizeId, count(*), group_concat(productSizeGroupId) from ProductSizeGroupHasProductSize where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from ProductSku where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from OrderLine where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from CartLine where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from DictionarySize where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from DirtySku where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from MarketplaceAccountHasProductSku where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from ProductShippingInfo where productSizeId in (:new,:old) GROUP BY productSizeId;
select productSizeId, count(*) from StorehouseOperationLine where productSizeId in (:new,:old) GROUP BY productSizeId;

select *
from ProductSku
where productSizeId = :old and
      (productId, productVariantId, shopId) in (
        select productId,productVariantId,shopId
        from ProductSku
        where productSizeId
              in (:new,:old)
        GROUP BY productId, productVariantId, shopId
        HAVING count(*) > 1);

BEGIN;
START TRANSACTION;
UPDATE ProductSizeGroupHasProductSize set productSizeId = :new where productSizeId = :old;
UPDATE ProductSku set productSizeId = :new where productSizeId = :old;
UPDATE OrderLine set productSizeId = :new where productSizeId = :old;
UPDATE CartLine set productSizeId = :new where productSizeId = :old;
UPDATE DictionarySize set productSizeId = :new where productSizeId = :old;
UPDATE DirtySku set productSizeId = :new where productSizeId = :old;
UPDATE MarketplaceAccountHasProductSku set productSizeId = :new where productSizeId = :old;
UPDATE ProductShippingInfo set productSizeId = :new where productSizeId = :old;
UPDATE StorehouseOperationLine set productSizeId = :new where productSizeId = :old;
DELETE FROM ProductSize where id = :old;
COMMIT ;
END;