Created
February 19, 2009 07:40
-
-
Save anonymous/66776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The query: | |
select episodes.id from episodes | |
left outer join links on links.link_id = episodes.link_id | |
where episodes.link_id > 0 and links.link_id is NULL | |
The attempt: | |
Episode.find(:all, :include => :link, :conditions => "links.link_id = episodes.link_id") | |
Produces: | |
SELECT episodes.id FROM "episodes" | |
LEFT OUTER JOIN "links" ON "links".link_id = "episodes".link_id | |
WHERE (links.link_id = episodes.link_id) | |
It's close! How can I change Rails's WHERE clause to mine above? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment