SequelizeDatabaseError missing FROM-clause entry for table

This take me half day on the simple task like:

A LEFT JOIN B

Filter combined table

TLDR;

Sequelize use subquery by default and sometimes doesn’t translate well.
Use duplicating to convert sub-query to simple join

References

https://sequelize.org/master/class/lib/model.js~Model.html#static-method-findAll

Documentation for is hidden here:

Full Discussion

Check out this issues for the full discussion and finally answered by the author of Sequelize.

https://github.com/sequelize/sequelize/issues/4446

Cheers !