This take me half day on the simple task like:
A LEFT JOIN B
Filter combined table
Sequelize use subquery by default and sometimes doesn’t translate well.
duplicating: false to convert sub-query to simple join
duplicating is hidden here:
Mark the include as duplicating, will prevent a subquery from being used
Check out this issues for the full discussion and finally answered by the author of Sequelize.