Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT max(oim2.meta_value/oim3.meta_value) FROM `wp_woocommerce_order_itemmeta` as oim
- INNER join wp_woocommerce_order_items as oi
- on oim.order_item_id = oi.order_item_id
- inner join wp_woocommerce_order_itemmeta as oim2
- on oim.order_item_id = oim2.order_item_id
- inner join wp_woocommerce_order_itemmeta as oim3
- on oim.order_item_id = oim3.order_item_id
- inner join wp_postmeta as pm
- ON pm.post_id = oi.order_id
- where pm.meta_key = '_customer_user' and pm.meta_value = 14
- and oim.meta_key = '_product_id'
- and oim.meta_value = 215
- and oim2.meta_key = '_line_subtotal'
- and oim3.meta_key = '_qty'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement