A
Anandh Kumar
Hi everyone
Consider there are three tables book,money,card in database.
Book has got column names name,price.
Money has got column names price,type.
Card has got column names type,id.
Now based on the 'id' of the 'card' i've to fetch 'name' of the 'book'.
So i m writing a query in RoR model as
Book.findall, :select => "book.name",
:joins => "INNER JOIN money ON money.price =
book.price" +
"INNER JOIN card ON card.type = money.type",
:conditions => "`card`.`id` = '10'")
But this doesnt work.Is there any alternate query or i m missing
something in this query.
Any help would be appreciated.
Thanks in advance
Anandh
Consider there are three tables book,money,card in database.
Book has got column names name,price.
Money has got column names price,type.
Card has got column names type,id.
Now based on the 'id' of the 'card' i've to fetch 'name' of the 'book'.
So i m writing a query in RoR model as
Book.findall, :select => "book.name",
:joins => "INNER JOIN money ON money.price =
book.price" +
"INNER JOIN card ON card.type = money.type",
:conditions => "`card`.`id` = '10'")
But this doesnt work.Is there any alternate query or i m missing
something in this query.
Any help would be appreciated.
Thanks in advance
Anandh