Skip to content

Instantly share code, notes, and snippets.

@maycomayco
Created April 10, 2018 19:19
Show Gist options
  • Save maycomayco/c48daafc6712d5ab5a5a235085e4988b to your computer and use it in GitHub Desktop.
Save maycomayco/c48daafc6712d5ab5a5a235085e4988b to your computer and use it in GitHub Desktop.
Find Woocommerce product whit empty SKU
SELECT p.ID,
p.post_title,
p.post_type,
pm.meta_value
FROM wp_posts p
LEFT JOIN wp_postmeta pm
ON pm.post_id = p.ID
AND pm.meta_key = '_sku'
WHERE p.post_type = 'product'
AND (pm.meta_value = ''
OR pm.meta_value IS NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment