Repeat Selection
I have a feeling the answer is in my sqlcode here.
SELECT *, DATE_FORMAT(datecreated,'%d %M %Y') as printdate
FROM invoice
LEFT JOIN customers ON customers.customerid = invoice.invoiceid
LEFT JOIN products ON products.invoiceid = invoice.invoiceid
LEFT JOIN preferences ON customers.prefid = preferences.prefid
WHERE invoice.print = '1'
This actually produces five records in total, there are only 3 invoices so the five products are linked to the 3 invoices. But to get the correct number of invoices i need to use the Group By function for Invoices, but then I lose the correct number of products and services.
john