I’m having this error using sequealize:
“sqlMessage”: “Unknown column ‘RModel.amount’ in ‘field list'”
Everything was working as expected until I added the calculation based on the amount value from the RModel by the interest value from OModel, I tried with double quotes and/or parenthesis. Maybe having two values from two different tables is causing the issue?
const result = await OModel.findAll({
where: {
requestId: requestId
},
include: {
model: RModel,
attributes: [
'amount'
]
},
attributes: [
'id',
'interest',
[
Sequelize.literal('RModel.amount * OModel.interest'),
'amountXInterest'
]
]
});