Skip to content

Instantly share code, notes, and snippets.

@moxie
Created November 8, 2012 16:58
Show Gist options
  • Save moxie/4040062 to your computer and use it in GitHub Desktop.
Save moxie/4040062 to your computer and use it in GitHub Desktop.
-- Returns only FL for desired_work_location
SELECT GROUP_CONCAT(resume_locations.location_state) as desired_work_locations
FROM `resumes`
LEFT JOIN `resume_locations` ON `resume_locations`.`resume_id` = `resumes`.`id`
WHERE (resume_locations.location_state = 'FL')
GROUP BY resumes.id
-- Returns FL,NY,AZ,NH for desired_work_locations
SELECT GROUP_CONCAT(resume_locations.location_state) as desired_work_locations
FROM `resumes`
LEFT JOIN `resume_locations` ON `resume_locations`.`resume_id` = `resumes`.`id`
GROUP BY resumes.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment