lol sorry I'm not too hot on SQL and as soon as I saw temp tables and functions my eyes glazed over...
I have:
SELECT
months.monthid,
months.month,
months.realmonthid,
SUM(invoices.cinvoicesubtotal) AS Total,
clients.clientname,
invoices.invoicedate
FROM
months
LEFT OUTER 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
But still only showing the months with invoices - I definitely need some kind of refresher course! 🙁