I now have the following SQL, but it doesn’t return the correct count. What I am trying to achieve is a count on all rows returned from locations even if none are matched against job_locations table. If that makes any sense
SELECT locations . * , count( jobs_locations.job_id ) AS count
FROM locations
INNER JOIN jobs_locations ON TRIM( SUBSTRING_INDEX( jobs_locations.display_name, ',', -1 ) ) = locations.location_name
ORDER BY locations.location_name
LIMIT 0 , 30