Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kowalikus/f205fbd2c3e9401320ae0ec7f47717c4 to your computer and use it in GitHub Desktop.
Save kowalikus/f205fbd2c3e9401320ae0ec7f47717c4 to your computer and use it in GitHub Desktop.
-- catalog_product_entity_varchar
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_varchar` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_varchar` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_varchar` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_varchar` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_varchar` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
-- catalog_product_entity_text
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_text` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_text` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_text` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_text` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_text` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
-- catalog_product_entity_int
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_int` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_int` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_int` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_int` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_int` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
-- catalog_product_entity_decimal
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_decimal` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_decimal` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_decimal` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_decimal` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_decimal` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
-- catalog_product_entity_datetime
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_datetime` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_datetime` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_datetime` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_datetime` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_datetime` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
-- catalog_product_entity_gallery
SELECT `value_id`, (SELECT `attribute_code` FROM `eav_attribute` ea WHERE
ea.`attribute_id` = cpev1.`attribute_id`) AS attribute_code, `value`, (SELECT `value` FROM `catalog_product_entity_gallery` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_lampy, (SELECT `value_id` FROM `catalog_product_entity_gallery` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) AS value_id_lampy FROM `catalog_product_entity_gallery` cpev1
WHERE cpev1.`store_id` = 0
AND (SELECT `value` FROM `catalog_product_entity_gallery` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) IS NOT NULL
AND (SELECT `value` FROM `catalog_product_entity_gallery` cpev2 WHERE
cpev1.`entity_id` = cpev2.`entity_id`
AND cpev1.`entity_type_id` = cpev2.`entity_type_id`
AND cpev1.`attribute_id` = cpev2.`attribute_id`
AND cpev2.`store_id` = 1) <> cpev1.value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment