MySQL Query To Produce Output Per Month Based On Variable Duration Entries <p>Ok, so I have a table that contains payments associated with dates and durations.</p> <p>Example data:</p> <pre><code>purchase_id date_purchased user_id duration (in months) amount_income 1 2013-12-28 00:00:00 1 2 £15 2 2014-01-04 00:00:00 2 1 £10 3 2014-02-04 00:00:00 3 6 £40 </code></pre> <p>*So the longer duration users pay for, the less they pay per month overall.</p> <p>What I'm trying to display is the total income per month based on this table. So a payment of £15 over 2 months would mean £7.50 income per month for 2 months.</p> <p>Sample output:</p> <pre><code>Month Amount 2013-12 £7.50 2014-01 £17.50 2014-02 £6.66 2014-03 £6.66 2014-04 £6.66 2014-05 £6.66 2014-06 £6.66 2014-07 £6.66 </code></pre> <p>This output corresponds to the sample input above. Hopefully it clarifies the breakdown of the income per month.</p> <p>Any ideas how to do this in a query?</p>