how to get the column sum using sequelize code example
Example 1: count in sequelize example
exports.getItemSaleCount = () => SaleItem.findAll({ attributes: ['itemId', [sequelize.fn('count', sequelize.col('itemId')), 'count']], group : ['SaleItem.itemId'], raw: true, order: sequelize.literal('count DESC') });
Example 2: count using sequelize.fn
exports.getMinPrice = () => Item.findAll({ attributes: [[sequelize.fn('min', sequelize.col('price')), 'minPrice']], });