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
And, How can I access its values?
Greetings and thanks.
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.