1
I need to select below using sequelize.
SELECT COUNT(*) AS 'Count'
FROM Table
WHERE
CAST(DatetimeField AS DATE) = CAST(GETDATE() AS DATE)
So far I’ve managed to do using between but it’s not the best way to do it:
return model.findAll({
attributes: [
[sequelize.fn('COUNT', sequelize.col('*')), alias]
],
where: {
CreationDate: {
$between: ['2017-09-15 00:00:00', '2017-09-15 23:59:59']
}
}
});
Can help?