mysql sequelize 聚合
User.findAll({attributes: [[sequelize.fn('COUNT', sequelize.col('*')), 'email']],raw: true }).then(function(users) { console.log(users) })
sequelize.fn(聚合的函数,聚合里面的参数)email 为聚合的列
sequelize.col('*') 往聚合里面添加参数
User.findAll({attributes: [[sequelize.fn('COUNT', sequelize.col('*')), 'email']],raw: true }).then(function(users) { console.log(users) })
sequelize.fn(聚合的函数,聚合里面的参数)email 为聚合的列
sequelize.col('*') 往聚合里面添加参数