Sequelize INNER JOIN

  javascript, node.js, sequelize.js

I need to Inner Join with sequelize. I tried something but i cant understand it.Anyone help me for this ;

I have two model that are Users and Payments. I want to get Users with payments data.

I shared basicaly Example below
Anyone explain for me ? and how can i make it ?

Totaly need ‘ SELECT * FROM Users INNER JOIN Payments ON Users.id=Payments.user_id WHERE Users.email=?’;

Users.findOne({
where:{
user_email:payload.email
},
include:[{
model:Payments,
where:['Payments.user_id = Users.id']
}]
})

enter image description here

Source: Ask Javascript Questions

LEAVE A COMMENT