Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select sum(pm1.meta_value) as total_profit from wp_postmeta as pm1
- inner join wp_posts as p on pm1.post_id = p.ID
- inner join wp_postmeta as pm2 on pm2.post_id = p.ID
- where pm1.meta_key = '_order_profit' and pm2.meta_key = '_customer_user' and pm2.meta_value = 17
- and p.post_type = 'shop_order' and p.post_status in ( 'wc-completed', 'wc-processing' )
- and p.post_date between '2018-12-25 00:00:00' and '2018-12-26 00:00:00'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement