Skip to content

Instantly share code, notes, and snippets.

@drobinson
Created April 7, 2018 18:33
Show Gist options
  • Save drobinson/9bc8de824f9a9c49af2898001a3b150f to your computer and use it in GitHub Desktop.
Save drobinson/9bc8de824f9a9c49af2898001a3b150f to your computer and use it in GitHub Desktop.
Simple historical payment information report by month
select year(sfo.created_at) as year, monthname(sfo.created_at) as month, method, count(sfop.entity_id) as orders, round(sum(amount_paid), 2) as total_revenue from sales_flat_order_payment as sfop
left join sales_flat_order as sfo on sfop.parent_id = sfo.entity_id
group by year(sfo.created_at), month(sfo.created_at), method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment