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

Fix for issue #2145
`sequelize 1.7`
We have to generate the string because it can have a `sequelize.fn`
It is tricky ... maybe we can build a method `this.getTableName(t, factory)`