# Duplicate joins when combining scopes and :include

**URL:** <https://www.ruby-forum.com/t/duplicate-joins-when-combining-scopes-and-include/168874>\
**Category:** Rails\
**Created:** [May 26, 2009, 11:21pm UTC](https://www.ruby-forum.com/t/duplicate-joins-when-combining-scopes-and-include/168874 "2009-05-26T23:21:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSSS\_nas\_Tryggvi\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f07891/32.png) [@JSSS\_nas\_Tryggvi\_J](https://www.ruby-forum.com/u/JSSS_nas_Tryggvi_J)\
**Post date:** [May 26, 2009, 11:21pm UTC](https://www.ruby-forum.com/t/duplicate-joins-when-combining-scopes-and-include/168874/1 "2009-05-26T23:21:18Z")

</div>

Hi,

I have an app using Rails 2.3.2 that chains together multiple scopes  
with joins and conditions on different tables. When I add :include to  
the finders that use these scopes, I get an Mysql::Error saying Not  
unique table/alias for the table that I’m including, and joining on in  
scopes.

The join strings are exactly the same, but the same left outer join is  
repeated in the SQL. I thought them being string identical would  
prevent that from happening?

Is this a known problem with any workarounds? At the moment I just  
skip the eager loading, which is hurting performance.

Thanks.
