# Join types

**URL:** <https://www.ruby-forum.com/t/join-types/189906>\
**Category:** Rails\
**Created:** [June 9, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/join-types/189906 "2010-06-09T18:40:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@JohnnyC](https://www.ruby-forum.com/u/JohnnyC)\
**Post date:** [June 9, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/join-types/189906/1 "2010-06-09T18:40:10Z")

</div>

I’m sure this is not a new topic – I’ve read mention of it elsewhere  
– but in addition to :joins =\> :profile, Active Record also  
needs :inner\_joins =\> :profile, :outer\_joins =\> :profile, :left\_joins  
=\> :profile, and all the popular combinations of join types.

I’ve got a sqlite development environment with mysql in production.  
mysql says “what?” when it see LEFT OUTER JOIN.

I’m going to try playing with database specific code through the  
ActiveRecord::Base.instanceof? method, but that certainly isn’t a  
particularly elegant approach.

---

<div class="post-metadata">

**Author:** ![JohnnyC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@JohnnyC](https://www.ruby-forum.com/u/JohnnyC)\
**Post date:** [June 9, 2010, 7:32pm UTC](https://www.ruby-forum.com/t/join-types/189906/2 "2010-06-09T19:32:15Z")

</div>

On Jun 9, 12:38 pm, JohnnyC [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m sure this is not a new topic – I’ve read mention of it elsewhere  
> – but in addition to :joins =\> :profile, Active Record also  
> needs :inner\_joins =\> :profile, :outer\_joins =\> :profile, :left\_joins  
> =\> :profile, and all the popular combinations of join types.

Why not just use :include? Then it will be portable and do the right  
type of join (or maybe no join at all if not needed)

---

<div class="post-metadata">

**Author:** ![JohnnyC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@JohnnyC](https://www.ruby-forum.com/u/JohnnyC)\
**Post date:** [June 9, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/join-types/189906/3 "2010-06-09T20:27:19Z")

</div>

JohnnyC wrote:

> I’m sure this is not a new topic – I’ve read mention of it elsewhere  
> – but in addition to :joins =\> :profile, Active Record also  
> needs :inner\_joins =\> :profile, :outer\_joins =\> :profile, :left\_joins  
> =\> :profile, and all the popular combinations of join types.
> 
> I’ve got a sqlite development environment with mysql in production.  
> mysql says “what?” when it see LEFT OUTER JOIN.

That’s probably not the actual issue. According to  
[http://dev.mysql.com/doc/refman/5.0/en/join.html](http://dev.mysql.com/doc/refman/5.0/en/join.html) , LEFT OUTER JOIN is  
legal in MySQL.

What errors are you actually getting?

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
