I have an update query like below which contains a join statement which is not a defined association. What would be the best way to convert this query to sequelize. I have googled but could not find a proper way to do this. I do not want to choose sequelize.literal or sequlize.query unless there is no alternative, and if there is not, then what would be the correct way to achieve this
UPDATE employees as comm left join (
SELECT
totalamount,
username, paid FROM payments as total where
paid=0 and group by username
) as tot on comm.username=tot.username
SET comm.paid = 1, comm.paidDate = NOW(), comm.paidBy = ?
where comm.username= ?
and comm.paid=0 and tot.totalamount = ?;