MySQL Forums
Forum List  »  General

Re: Problem with a complex SQL query - select total user count, invoice count for each month from specified period
Posted by: Radoslav Yankov
Date: May 31, 2013 07:35AM

Thank you very much, Peter! I have tested the code but unfortunately it doesn't work correctly and I can't find where exactly the problem is.
I have created a table reportcal and inserted values for the period 2011-2013 year. Thean I have created the utility function. Áfter executing the query I don't get any errors but the result is not as expected.
1. I don't get information about each month from the specified period but I need exactly this.
2. The results are wrong. I have 36 users and 1552 invoices in the whole database for the period June 2011 - May 2013. The data in the columns Registrations, Registrations so far and Invoices are exactly the same in each row and I don't understand why. E.g. for the period between '201101' and '201305' I'm getting following result:
Year Month Regs Regs so far Active Invoices
2011| 6| 2| 2| 1| 2
2011| 8| 2| 2| 1| 2
2011| 11| 83| 83| 3| 83
2011| 12| 312| 312| 4| 312
2012| 1| 240| 240| 9| 240
2012| 3| 204| 204| 6| 204
2012| 6| 33| 33| 6| 33
2012| 8| 37| 37| 4| 37
2012| 9| 122| 122| 6| 122
2012| 10| 78| 78| 6| 78
2012| 12| 202| 202| 6| 202

I tried everything but couldn't find the error. Could you please help me again.
Many thanks in advance!



Edited 1 time(s). Last edit at 05/31/2013 07:41AM by Radoslav Yankov.

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with a complex SQL query - select total user count, invoice count for each month from specified period
May 31, 2013 07:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.