Basically after executing this query:
SELECT
`view_customer_locations`.customerid,
`view_customer_locations`.community_groupid,
`view_customer_locations`.community_group,
`view_sip_user_agents`.sip_user_agentid,
`view_sip_user_agents`.didid,
`view_sip_user_agents`.temporary_didid,
`view_sip_user_agents`.active_did,
GROUP_CONCAT( (IF(`view_sip_user_agents`.active_did = 'permanent', cast(`permanent_dids`.did as char(10)), cast(`temporary_dids`.did as char(10)))) SEPARATOR ', ') as did,
`view_sip_user_agents`.sip_user_agents_date_archived
FROM `view_customer_locations`
LEFT JOIN `view_sip_user_agents` on `view_customer_locations`.customerid = `view_sip_user_agents`.customerid
LEFT JOIN `dids` AS permanent_dids ON `view_sip_user_agents`.didid = `permanent_dids`.id
LEFT JOIN `dids` AS temporary_dids ON `view_sip_user_agents`.temporary_didid = `temporary_dids`.id
Group by `view_customer_locations`.customerid
i still want all the rows from the view_customer_locations table.. but i am losing any entries in the view_customer_locations table that don't have a corresponding record in the view_sip_user_agents table. I also want the entries to be grouped by customerid .. so that each customer only has one entry in the resulting query.
If i remove the group by clause, i get all the entires from the view_customer_locations table but naturally i have multiple entries per customer which is not what i want.
please help