I am looking for group by queries through Sequelize and cannot seem to find any documentation.
SELEC
Group by with count sequelize ORM
'field' - you can rename this string, it's your field(column) in database
'count' - reserved string need for get count in sequelize
'cnt' - you can rename this string, it's your output count
Sequelize version 3.25.0
User.findAll({
attributes: ['field', [sequelize.fn('count', sequelize.col('field')), 'cnt']],
group: ['field'],
})