Sequelize.fn('MAX' code example
Example 1: sequelize.fn
// Counting number of totalPrice from column itemPrice table
Model.findAll({
attributes: {
include: [
[sequelize.fn('COUNT', sequelize.col('itemPrice')), 'totalPrice']
]
}
});
Example 2: sequelize max
exports.getMinPrice = () => Item.findAll({ attributes: [[sequelize.fn('min', sequelize.col('price')), 'minPrice']], });