Hi,
I need some help with a MySQL command.
I have three tables for an address book: contact, which has the list of people; address, which has a list of addresses; and groups, which is what group the person belongs in. A person may belong in more than one group or none at all. I have the following code to retrieve the contact and primary address if given a group ID number ($groupID).
SELECT contact.id, CONCAT(lastname,\', \',firstname) AS fullname, lastname, firstname, line1, line2, city, state, zip, phone1, phone2, country FROM address_contact as contact, address_groups as groups LEFT JOIN address_address as address ON contact.id=address.id AND contact.primaryAddType=address.type WHERE contact.id=groups.id AND groups.groupid=$groupID ORDER BY fullname;
What I can\'t figure out is how to retrieve a list of contacts (with their primary addresses) that belong in NO group. Does anyone have any suggestions?