Fix ORDER BY with INNER, OUTER JOIN and LIMIT, issue #2145

Fix for issue #2145
`sequelize 1.7`
Here a solution for this part

```javascript
      if (subQuery) {
        // We need primary keys
        subQueryAttributes = mainAttributes
        !Array.isArray(tableName) ? subQueryAs.push(tableName) : subQueryAs.concat(tableName)
        mainAttributes = [options.table+'.*']
      }
```