Answers for "sequelize count in include"

1

sequelize count in include

Location.findAll({
    attributes: { 
        include: [[Sequelize.fn("COUNT", Sequelize.col("sensors.id")), "sensorCount"]] 
    },
    include: [{
        model: Sensor, attributes: []
    }]
});
Posted by: Guest on September-30-2020
0

count using sequelize.fn

exports.getMinPrice = () => Item.findAll({    attributes: [[sequelize.fn('min', sequelize.col('price')), 'minPrice']],  });
Posted by: Guest on May-30-2020

Browse Popular Code Answers by Language