Node.js 在内部联接续集中选择最大值
如何将此sql查询转换为Sequelize 选择a.id、a.name、max(b.sentAt)作为sentAt从站点作为内部连接监视\u数据\u信息作为b on a.id=b.stationId按a.id、a.name分组 结果是: 我尝试此代码,但它不运行:Node.js 在内部联接续集中选择最大值,node.js,sequelize.js,max,inner-join,Node.js,Sequelize.js,Max,Inner Join,如何将此sql查询转换为Sequelize 选择a.id、a.name、max(b.sentAt)作为sentAt从站点作为内部连接监视\u数据\u信息作为b on a.id=b.stationId按a.id、a.name分组 结果是: 我尝试此代码,但它不运行: static findStationInfo (){ return this.findAll({ attributes : ['id', 'name', [Sequelize.fn('max', Sequelize
static findStationInfo (){
return this.findAll({
attributes : ['id', 'name', [Sequelize.fn('max', Sequelize.col('sentAt')), 'sentAt']],
include: [{model: MonitoringDataInfo, attributes : [], required: true}],
group: ['Station.id', 'Station.name']
})
}
你有什么错误吗?