const customers = await this.repository.findAndCountAll({
where: condition,
attributes: {
// exclude: ['user_id', 'account_id', 'deletedAt'],
include: [
[
Sequelize.literal(`(
SELECT SUM(amount)
FROM transactions
WHERE transactions.customer_id = customers.id
and transaction_type='PAYOUT'
)`), 'totalDebit'
]
]
},
limit,
offset,
include: {
association: 'groups',
where: { id: groupId },
through: { attributes: [] },
attributes:[],
required: true
},
order:[['createdAt', 'DESC']],
raw: true,
});
return customers
Customers is the table name, but i am getting
Unknown column ‘customers.id’ in ‘where clause’
I have tried every possible solutions, even directly from the documentation, kindly help out.
Sequelize,Sequelize typescript,