this.User.findAll({
attributes: ['id', [sequelize.literal("firstname ||
' ' || lastname "),"
fullName "],"
fullName "],where: {
fullName: {
[Op.like]: '%' searchData "%"
}
}
})
//SQLITE_ERROR: no such column: fullName
CodePudding user response:
Use the same literal in Sequelize.where
to achieve your goal:
this.User.findAll({
attributes: ['id', [sequelize.literal("firstname ||
' ' || lastname "),"
fullName "],"
fullName "],
where: Sequelize.where(sequelize.literal("firstname ||
' ' || lastname "), Op.like, '%' searchData '%')
})