Thanks guys, the first query is working fine now.

Rails is still rejecting the syntax of this subselect:

@books = Books.find_by_sql ["SELECT * FROM books WHERE title IN SELECT 
title FROM authors WHERE name = ?", params[:author][:name]]

I know the inner select should be in (), but its not taking it where I 
put it.
Can any one see what the problem is?
Thanks
Cypray







Frederick Cheung wrote:
> On 8 Dec 2008, at 23:36, Ryan Bigg wrote:
> 
>>
>> If it's coming in dynamically, wouldn't it be params[:author][:name]
>> or something similar? A bit hard to guess without seeing more code.
> 
> D'oh of course, not sure why I wrote author[:name]
> 
> Fred

-- 
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to