Hi - just had a brainwave - I'm nearly there I *think*
I have added a months table with monthid, realmonthid, monthname. April being the first month of the financial year, it would have monthid 1, realmonthid 4. I join this table to the invoices table on the month part of the invoice date. I set the datefrom and dateto to the beginning and end of the financial year in question. Am I completely off the mark here? I have the following query now:
SELECT
months.monthid,
months.month,
months.realmonthid,
SUM(invoices.cinvoicesubtotal) AS Total,
clients.clientname,
invoices.invoicedate
FROM
months
INNER JOIN
invoices ON months.realmonthid = MONTH(invoices.invoicedate)
INNER JOIN
clients ON invoices.clientid = clients.clientid
WHERE invoices.invoicedate BETWEEN '01-apr-2007' AND '31-mar-2008'
GROUP BY
months.monthid,
months.month,
months.realmonthid,
clients.clientname,
invoices.invoicedate
ORDER BY months.monthid
This works but only brings up the months where invoices have been placed - how would I get all of the other months to display properly?