Created
April 8, 2020 13:58
-
-
Save JAW-Dev/7ecd66477926dc25ae427220248ad305 to your computer and use it in GitHub Desktop.
Low Stock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.post_title as 'Name', pm.meta_value as 'SKU', pm2.meta_value as 'Stock' | |
FROM wp_posts p | |
INNER JOIN wp_postmeta pm | |
ON p.ID = pm.post_id | |
INNER JOIN wp_postmeta pm2 | |
ON p.ID = pm2.post_id | |
AND pm.meta_key = '_sku' | |
AND ((pm2.meta_key = '_stock' AND CAST(pm2.meta_value AS SIGNED) BETWEEN '1' AND '4' )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment