# Join di 3 tabelle

**URL:** <https://www.ruby-forum.com/t/join-di-3-tabelle/82907>\
**Category:** IT\
**Created:** [January 22, 2007, 10:16am UTC](https://www.ruby-forum.com/t/join-di-3-tabelle/82907 "2007-01-22T10:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@stb](https://www.ruby-forum.com/u/stb)\
**Post date:** [January 22, 2007, 10:16am UTC](https://www.ruby-forum.com/t/join-di-3-tabelle/82907/1 "2007-01-22T10:16:30Z")

</div>

Ciao,

devo fare il join di tre tabelle del mio db, in sql non penso di aver  
grossi problemi visto che posso fare il primo join nella clausula from e  
il secondo in quella inner join per esempio.

Il punto è che preferirei farlo tramite il metodo find di active record  
Come si fa?

Saluti Andrea

---

<div class="post-metadata">

**Author:** ![stb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@stb](https://www.ruby-forum.com/u/stb)\
**Post date:** [January 22, 2007, 10:45am UTC](https://www.ruby-forum.com/t/join-di-3-tabelle/82907/2 "2007-01-22T10:45:25Z")

</div>

> **[Rails 1.1: RJS, Active Record++, respond\_to, integration tests, and 500 other...](https://rubyonrails.org/2006/3/28/rails-1-1-rjs-active-record-respond_to-integration-tests-and-500-other-things)**
>
> The biggest upgrade in Rails history has finally arrived. Rails 1.1 boasts more than 500 fixes, tweaks, and features from more than 100 contributors. Most of the updates just make everyday life a little smoother, a little rounder, and a little more...

(…)  
Bottomless eager loading gives you the power of pulling back a  
multi-level object graph in a single JOIN-powered SQL query. Example:

# Single database query:

companies = Company.find(:all, :include =\> {  
:groups =\> { :members=\> { :favorites } } })

# No database query caused:

companies[0].groups[0].members[0].favorites[0].name

You can mixâ€™nâ€™match too. Using both multi-level fetches and first-level  
ones in the same call:

# Just 1 database query for all of this:

authors = Author.find(:all, :include =\> [  
{ :posts =\> :comments }, :categorizations ])  
authors[0].posts[0].comments[0].body # =\> “Rock on Rails!”  
authors[0].categorizations[0].name # =\> “Less software”

Ciao  
Massimo

stb wrote:

> Ciao,
> 
> devo fare il join di tre tabelle del mio db, in sql non penso di aver  
> grossi problemi visto che posso fare il primo join nella clausula from e  
> il secondo in quella inner join per esempio.
> 
> Il punto ï¿½ che preferirei farlo tramite il metodo find di active record  
> Come si fa?
> 
> Saluti Andrea

---

<div class="post-metadata">

**Author:** ![stb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@stb](https://www.ruby-forum.com/u/stb)\
**Post date:** [January 22, 2007, 10:51am UTC](https://www.ruby-forum.com/t/join-di-3-tabelle/82907/3 "2007-01-22T10:51:33Z")

</div>

ah perfetto penso di sistemare cosÃ¬, grazie mille  
----- Original Message -----  
From: “Massimo” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Monday, January 22, 2007 10:45 AM  
Subject: [ruby-it] Re: Join di 3 tabelle

> # No database query caused:
> 
> > Il punto ï¿½ che preferirei farlo tramite il metodo find di active record  
> > Come si fa?
> > 
> > Saluti Andrea
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

* * *
