Skip to content

Instantly share code, notes, and snippets.

@mtbottens
Created April 12, 2018 15:59
Show Gist options
  • Save mtbottens/45ad72f35be15e201a42e66236219a67 to your computer and use it in GitHub Desktop.
Save mtbottens/45ad72f35be15e201a42e66236219a67 to your computer and use it in GitHub Desktop.
INSERT INTO
catalog_product_website (website_id, product_id)
SELECT
sw.website_id,
cpw.product_id
FROM
store_website sw
JOIN (
SELECT
cpwd.product_id
FROM
catalog_product_website cpwd
GROUP BY
cpwd.product_id
HAVING count(cpwd.product_id) = 1
) cpw
WHERE
sw.website_id != 0 AND sw.website_id != 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment