I want to display all users except who's role name is an admin trader and customer.
User table has: id, name, email and password
Role table has: id, role_name
RoleMapping has: id, user_id and role_id
here is my query
models.User.findAll({
include: [{
model: models.RoleMapping,
as: 'user_role',
attributes: ['user_id', 'role_id'],
include: [{
model: models.Role,
as: 'Role',
attributes: ['id', 'role_name', ],
}]
}],
where :{
'$Role.role_name$': {
$notIn: ['Trader','Customer','admin']
}
}
})
getting this error error: missing FROM-clause entry for table "Role"