Answer the question
In order to leave comments, you need to log in
Is there an implementation of SELECT FLOOR(.....) as UserVariable in sequilize, when using a model?
I am writing a complex query to the database. It is necessary to implement a line that would generate the following line in the SELECT part of the query:
FLOOR(UNIX_TIMESTAMP(`tablename`.`timestamp`) /24 /60 /60) AS mtime
models.devices.findAll({
where: {
id: {$in: mas_id},
enabled: true
},
order: ,
attributes: [
'id',
'name',
[
models.sequelize.fn('sum', models.sequelize.col('devices_keys->devices_statistics.count')),
'sums'
]
],
include: [{
model: models.devices_keys,
where:{
direction_id: 0
},
include: [{
model: models.stat_keys,
where:{
id: {$in: [1,2]}
}
},{
model: models.devices_statistics,
where:{
timestamp: {$between: ['2018-06-12 00:00:00','2018-06-15 00:00:00']}
}
}]
}]
}).then(data2 => {....})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question