Skip to content

Instantly share code, notes, and snippets.

@cgartner-redstage
Created January 15, 2021 19:36
Show Gist options
  • Save cgartner-redstage/977cc5f0cafdb5c017905be448fb478d to your computer and use it in GitHub Desktop.
Save cgartner-redstage/977cc5f0cafdb5c017905be448fb478d to your computer and use it in GitHub Desktop.
Magento 2 DB Queries
# Get product SKU by url key
select e.entity_id,e.sku,v.value from catalog_product_entity e
inner join catalog_product_entity_varchar v on e.entity_id = v.entity_id and
attribute_id = (select attribute_id from eav_attribute where attribute_code = 'url_key' and entity_type_id = 4)
where v.value = '<url_key>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment