Help with group_concat and count
Is it possible to have a query that if the count is bigger than 1 it will put the value "More than 1" otherwise it will do a GROUP_CONCAT.
For example, take this query:
Now, what I want to do is - if the count of rows on the INNER JOIN (jobs_locations) is bigger than 1, then it will pre populate with "More than 1", otherwise it will do the GROUP_CONCAT.
SELECT jobs.id, jobs.job_title, jobs.job_url, companies.company_name, companies.company_url, l.display_name
LEFT JOIN companies ON companies.id = jobs.company_id
INNER JOIN (
SELECT job_id, group_concat( display_name SEPARATOR ', ' ) AS display_name
GROUP BY job_id
) AS l ON l.job_id = jobs.id
WHERE companies.status = 'Active'
ORDER BY jobs.date_posted DESC
Is this possible?