Can I do a query SQL with various tables using find_by_sql?

  • Thread starter Jorge alejandro Mendoza torres
  • Start date
J

Jorge alejandro Mendoza torres

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.
 
B

Brian Candler

Jorge said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top