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.

Thanks in advance to anyone who can help.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to