Steve Castaneda wrote:
> Thanks for the homework!  I'll get to work on that.

Finally got it to work!  Here's what I ended up with:

--
@owners = Owner.find_by_sql("SELECT * FROM Owners
                                    LEFT JOIN Widgets
                                    ON (Widgets.owner_id = Owners.id)
                                    WHERE Widgets.owner_id IS NULL
                                    ")
--

I noticed that you used a letter to call the table later in the sql 
query.  Is that a shorthand method or something that I should do to make 
it better syntax wise?

Eg. ...

"SELECT * FROM Owners o
LEFT JOIN Widgets w
ON (w.owner_id = o.id)
WHERE w.owner_id IS NULL"

-- 
Posted via http://www.ruby-forum.com/.
-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to