Skip to content

Instantly share code, notes, and snippets.

@lewisvoncken
Last active March 8, 2020 16:54
Show Gist options
  • Save lewisvoncken/0c711ebc27f754d4dc40d3895bc75e1a to your computer and use it in GitHub Desktop.
Save lewisvoncken/0c711ebc27f754d4dc40d3895bc75e1a to your computer and use it in GitHub Desktop.
SELECT DISTINCT u.url_rewrite_id from store as s
INNER JOIN store_group as sg
ON s.group_id = sg.group_id
INNER JOIN catalog_category_entity as c
ON sg.root_category_id = SUBSTRING_INDEX(SUBSTRING_INDEX(c.path, '/', 2), '/', -1)
LEFT JOIN url_rewrite as u
ON c.entity_id = u.entity_id AND s.store_id != u.store_id
WHERE entity_type = 'category'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment