intersect outputs bad mysql syntax #132

aflag opened this Issue Aug 11, 2012 · 1 comment

2 participants


Assume there's a one to many relationship between people and projects.

This arel query:


outputs this SQL

( SELECT id 
  FROM `people` INNER JOIN `services` ON `services`.`person_id` = `people`.`id` 
  WHERE `services`.`type` = 1
  SELECT id 
  FROM `people` INNER JOIN `services` ON `services`.`person_id` = `people`.`id` 
  WHERE `services`.`type` = 2 )

problem is that it's not valid mysql (though you can work around it with inner join tricks). I can't seem to make such query play nicely with activerecord.


I confirm this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment