Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrrhys/f449cc34d2ed86f1732f8a283c404c79 to your computer and use it in GitHub Desktop.
Save rrrhys/f449cc34d2ed86f1732f8a283c404c79 to your computer and use it in GitHub Desktop.
select pm_cust.meta_value as user_id, sum(pm_disc.meta_value) as disc_total
from wp_postmeta pm_cust
inner join wp_postmeta pm_disc
on pm_disc.post_id = pm_cust.post_id and pm_disc.meta_key = '_cart_discount'
where pm_cust.meta_key = '_customer_user' and pm_cust.meta_value = 8;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment