In my database i have 3 tables i wish to join.
1 table, enquiries has the main data,
1 table, addressees has addressee info,
1 table, enquiry_type has enquiry_type info.
Basically the 'enquiries' table contains IDs for 'addressee table', and the 'enquiry_type' table. What i want to do is to do a multiple join, so that i can show a count of all of the enquiries for each addressee and type.
So it would be something like:
addressee1, enquiry_type 1, count,
addressee1, enquiry_type 2, count,
addressee2, enquiry_type 1, count,
addressee2, enquiry_type 2, count.
i want each line to be displayed even if count is zero.
i have come up with
SELECT count( enquiries.id )
as count, enquiry_type.enquiry_type
as enquiry_type, addressees.addressee
as adressee
FROM enquiries, addressees
RIGHT JOIN enquiry_type ON enquiries.enquiry_type = enquiry_type.id
where addressees.id = enquiries.addressee_id
GROUP BY enquiry_type, addressee LIMIT 0, 30
However it doesn't show any line with zero counts.
Any ideas how i might do this??
TIA
Jamie