Results 1 to 4 of 4
Thread: Help with group_concat and count
Dec 3, 2011, 04:52 #1
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:
SELECT jobs.id, jobs.job_title, jobs.job_url, companies.company_name, companies.company_url, l.display_name FROM jobs LEFT JOIN companies ON companies.id = jobs.company_id INNER JOIN ( SELECT job_id, group_concat( display_name SEPARATOR ', ' ) AS display_name FROM jobs_locations 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?