Please have a look at this link first:
I'm currently trying to refactor that in Rails, here's some more info
- We are looking for Projects.
- A project has_and_belongs_to_many MDGs, Donors, Provinces and
If you write out the joins, you'll get 8 joins (1 for the join table
and one for the actual table).
That's a fair few joins, but not the end of the world, and databases
are likely to be better at doing this sort of thing than ruby.
In mysql if join optimiser is getting it wrong you can force the
ordering you supply