1👍
You can use this –
Expense.findAll({
attributes : ['categoryId', [db.sequelize.fn('SUM', db.sequelize.col('amount')), 'total']],
group : ['categoryId']
});
This will result in list of categories with their sum. You can apply other aggregate function too.
Source:stackexchange.com