Skip to content
Advertisement

Sequelize Include with Where Condition

I’m having a problem with how to query multiple include with where condition.

Tried it using direct query to sql and it works fine. I made a sample using sql and having a problem converting it to node.js with sequelize query.

This is the correct SQL

I tried it to convert it to sequelize and this is what I’ve done so far but it keeps getting error or correct results

I expected it to get like what the sql result is

Advertisement

Answer

Found out that we neeed to add required: false to make it work and code it like this.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement