I am looking for a simple script that will Query my MySQL database and generate a report based on the query. It will basically be querying one table (billing_log).
I need it to find all "amount" paid for each "account" field. Then add them up and give me an average spend amount per user (account). In other words. Each time a users account has been billed by us, an entry goes into the database. So an entry (account) might have have 10 entries in the database. We need to find all these and then add up all their dollar amounts (amount). Once we have this we would like to see the average spend per user. This is what I am after...the average spend per user (account) over the life of of their account.
Things you may need to know:
1. Table has around 10,000 total records
2. Also need to make the query for only those records with the "status" of "A". This is Approved transactions...not Declined.
3. The end result should show three numbers....Total Number of Accounts, Average Number of Transactions per account, and Average Spend per Account.
A demo would be great!
Hello. I am a professional MySQL developer. I have expertise in database design, optimisation and OLAP for enterprise projects.
I can make a fast query according to MySQL's optimisator mechanism.