I'm sure I have acheived this before but seem to be having problems recreating.
I want to display a list of "suppliers". A supplier can have more then one email address and email addresses are stored in a different table (email__addresses).
I want to display a list of suppliers on a page and I want that list of suppliers to display an just one email address for each supplier (does not matter which, just display one).
Of course when I do the query using a LEFT JOIN to link the tables it gives me my results, but it a supplier has more then one email address it is listed more then once.
Now I thought I had come across this problem before and simply used the
r_id) to make sure that at most each supplier isonly displayed once.
but when I use the code as shown in the code window it still displays a supplier multiple times if that supplier has more then one email address.
What am I missing?
SELECT DISTINCT(suppliers.supplier_id), suppliers.*, email_addresses.email_address FROM suppliers
LEFT JOIN email_addresses ON (supplier_id = emails_supplierid )