Guest User

Untitled

a guest
Apr 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // WORDPRESS 5.0-alpha-42433 + WOOCOMMERCE 3.2.6
  2.  
  3. SELECT
  4. MIN(meta_value) as min_price, MAX(meta_value) as max_price FROM wp_posts p
  5. JOIN wp_term_relationships tr ON (p.ID = tr.object_id)
  6. JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
  7. JOIN wp_terms t ON (tt.term_id = t.term_id)
  8. JOIN wp_postmeta pm ON (p.ID = pm.post_id)
  9. WHERE p.post_type='product'
  10. AND p.post_status = 'publish'
  11. AND tt.taxonomy = 'product_cat'
  12. AND t.term_id = <PUT A CAT ID HERE>
  13. AND pm.meta_key = '_price'
Add Comment
Please, Sign In to add comment