sequalize count code example
Example 1: sequelize findall 2 attributes
Model.findAll({
attributes: [[sequelize.fn('COUNT', sequelize.col('hats')), 'no_hats']]
});
Example 2: 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') });