Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var models = require('../../config/sequelize');
- models.device.findAll({
- attributes: [
- 'type',
- [models.sequelize.fn('count', models.sequelize.col('deviceId')),'count']
- ],
- group: ["device.type"]
- }).then(function (result) {
- result.forEach( function(e){
- console.log( e.count ) ;
- })
- }).catch(function(err) {
- console.log( "test group :"+JSON.stringify(err.message)) ;
- }); ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement