From: Brian Candler Date: 2010-03-06T07:35:16+09:00 Subject: Re: Can I do a query SQL with various tables using find_by_sql? Jorge alejandro Mendoza torres wrote: > Hello. > > I need to do a query with various tables, but I want to use something > like find_by_sql. > > It's say, i want to make the next query: > > SELECT field_table1,field_table1,field_table2 > FROM table1, table2 > WHERE table1.id=table2.table1_id It depends on what database access library you are using. There are many to choose from; there are direct native APIs to most databases, or the low-level DBI which wraps these. They'll all work at the level of SQL statements like SELECT. Then there are higher-level abstractions like ActiveRecord, Sequel, DataMapper, og, ... "find_by_sql" sounds like something from ActiveRecord. If your question is specifically about ActiveRecord, you might be better of asking in a Rails mailing list. -- Posted via http://www.ruby-forum.com/.