Advertisement
MrViSiOn

Mi actualización

Oct 25th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.23 KB | None | 0 0
  1. UPDATE
  2.   merce_product_attribute_combination modificando
  3.   INNER JOIN (
  4.       (SELECT
  5.         tidicho.id_attribute AS newId,
  6.         tidicho2.id_attribute AS oldId,
  7.         tidicho2.id_product_attribute
  8.       FROM
  9.         (SELECT
  10.           a.`id_attribute`,
  11.           a.`name`
  12.         FROM
  13.           merce_attribute_lang a
  14.           INNER JOIN
  15.             (SELECT
  16.               b.`name`,
  17.               COUNT(*) AS c
  18.             FROM
  19.               merce_attribute_lang b
  20.             WHERE b.`id_lang` = 1
  21.             GROUP BY b.`name`
  22.             HAVING c > 1) dup
  23.             ON a.`name` = dup.name
  24.         WHERE a.`id_lang` = 1
  25.         GROUP BY a.`name`) tidicho
  26.         INNER JOIN
  27.           (SELECT
  28.             a.`id_attribute`,
  29.             a.`id_product_attribute`,
  30.             b.`name`
  31.           FROM
  32.             `safisa_pre`.`merce_product_attribute_combination` a
  33.             INNER JOIN merce_attribute_lang b
  34.               ON a.`id_attribute` = b.`id_attribute`
  35.           WHERE b.`id_lang` = 1) tidicho2
  36.           ON tidicho.name = tidicho2.name) newidd
  37.     )
  38.     ON newidd.oldId = modificando.`id_attribute`
  39.     AND newidd.id_product_attribute = modificando.`id_product_attribute` SET `id_attribute` = newidd.newId
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement