I'm using a version of this script for a report. But I would like to add a column to the report that includes the packages each customer has. I figured out how to add the service.id, but I can't figure out how display the package name from that id.
Here is the script I'm running:
SELECT `contacts`.`client_id`, `contacts`.`id` AS `contact_id`, `contacts`.`first_name`, `contacts`.`last_name`, `contacts`.`email`, contacts.address1, contacts.city, contacts.zip, contacts.country, service.id, `services`.`status`, services.date_added, `services`.`date_canceled`, COUNT(`services`.`id`) AS `number_of_services`
FROM `contacts`
INNER JOIN `services` ON `services`.`client_id` = `contacts`.`client_id`
GROUP BY `contacts`.`id`
ORDER BY `contacts`.`client_id`, `contacts`.`id`