That's why people usually use link tables to deal with such many-to-many relationships. One service can have several zones, one zone can have several services. Querying a field separated by commas and using it in conjunction with another table is quite difficult.
You have two options, one of which assumes the correct solution, and one allows you to save the current database model. I highly recommend you do it right, but to answer your question, I will first go to another option.
Just separate your requests. Just enter a semicolon in your main query, then run the second query to get the zone names:
SELECT * FROM zone WHERE id IN ($zoneIdsYouSelected)
Now, if you are working with a listing, this is probably not very indicative, because it means that you will need to run one query for the list and another for each row. An alternative would be to get all the zones into an array, and then select from that using PHP based on $zoneIdsYouSelected . That way, you can slip away with two queries if you plan to achieve, as opposed to a single query per row of data.
The right way is to create a link table that simply contains two fields: zone_id and service_id . If you then make such a request, you will get all the names in one โfieldโ in your result set:
SELECT s.id, s.name, s.description, s.price, s.category, s.ordering, s.state, s.checked_out, s.checked_out_time, s.created_by, GROUP_CONCAT(DISTINCT z.name ORDER BY z.name ASC SEPARATOR ', ') AS zones FROM service s JOIN service_zone sz ON s.id = sz.service_id JOIN zone z ON z.id = sz.zone_id GROUP BY s.id, s.name, s.description, s.price, s.category, s.ordering, s.state, s.checked_out, s.checked_out_time, s.created_by ORDER BY s.id
You may have to tweak this query a bit, but I hope this is clear. Keep in mind that GROUP_CONCAT is not supported by all databases, but MySQL has it.
Again, both solutions may work fine and be workable, but having a field separated by a comma will create more problems like this. I highly recommend that you change the structure of the database. Read database normalization if you are not familiar with the idea of โโlink tables.