sequelize select fields code example
Example 1: sequelize .all()
yourTableModel.findAll({
//optional filters
where: {},
raw: true,
})
Example 2: in in sequelize
await Tag.findAll({
where: {
id: {
[Sequelize.Op.in]: [1, 2, 3, 4]
}
}
});
Example 3: sequelize get only one column
Project.findAll({attributes: ['name', 'age']}).on('success', function (projects) {
console.log(projects);
});
Example 4: SEQUELIZE OR
"SELECT * FROM Student WHERE LastName='Doe' OR FirstName in ("John","Jane") OR Age>18"