Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell

spencerfinnell/query.sql Secret

Created Jul 9, 2018
Embed
What would you like to do?
SELECT SQL_CALC_FOUND_ROWS wp_4_posts.ID
FROM wp_4_posts 
INNER JOIN wp_4_postmeta
ON ( wp_4_posts.ID = wp_4_postmeta.post_id )
WHERE 1=1 
AND ( wp_4_posts.ID NOT IN ( 
SELECT object_id 
FROM wp_4_term_relationships 
WHERE term_taxonomy_id IN (7) ) )
AND ( ( wp_4_postmeta.meta_key = '_price'
AND CAST(wp_4_postmeta.meta_value AS DECIMAL(10,2)) BETWEEN '1'
AND '82' ) )
AND wp_4_posts.post_type = 'product'
AND (wp_4_posts.post_status = 'publish'
OR wp_4_posts.post_status = 'private')
GROUP BY wp_4_posts.ID
ORDER BY wp_4_posts.post_date DESC, wp_4_posts.ID DESC
LIMIT 0, 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment