On May 11, 9:03 pm, Elliott <[email protected]> wrote: > Post.filter(:id => 10).union(Post.filter(:topic_id => 10).limit(5)) > returns the following SQL: > > SELECT * FROM `posts` WHERE (`id` = 10) UNION SELECT * FROM `posts` > WHERE (`topic_id` = 10) LIMIT 5 > > This would return five posts total. > > SELECT * FROM `posts` WHERE (`id` = 10) UNION (SELECT * FROM `posts` > WHERE (`topic_id` = 10) LIMIT 5) > > This would return six posts, the first post with id of 10 and five > additional posts. > > I'm unsure how to coerce Sequel into producing the latter, or if I > even can.
I just pushed a fix for this issue (http://github.com/jeremyevans/ sequel/commit/359941f44fdc643ef462ae07fb3aa08d2e3b8d97). It uses subselects instead of parentheses, but should have the same results and performance. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
