Creating custom reports to display outside of admin

Discussion in 'aMember Pro v.4' started by bennyuk1, May 1, 2013.

  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Using wordpress with am4

    Currently I use some sql queries to output a table of payments for certain products, eg:-

    SELECT * FROM am_user u, am_invoice_payment p,am_access a, am_product pr WHERE u.user_id=p.user_id and p.invoice_payment_id=a.invoice_payment_id and pr.product_id=a.product_id and a.product_id IN (8, 24, 25,52,53) ORDER BY dattm ASC

    This shows me the purchases for products 8, 24, 25,52,53.

    The problem is it DOES NOT show me any info on users that have had products assigned to them by admin (eg if they were given free, or they paid offline etc)

    However I need a bit more info about all the products. What I would like to output is:-

    Product | number of sales | number of free allocations (added by admin) | Sales amount £

    I'd like this to a line for each and every product (or at least for a large predefined range or category)

    Is it possible and if so can you give me a pointer on the SQL query?

Share This Page