I need to make the select below using sequelize.
SELECT COUNT(*) AS 'Count'
FROM Table
WHERE
CAST(DatetimeField AS DATE) = CAST(GETDATE() AS DATE)
So far I've been able to do this using between but this is not the best way to do this:
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 you help?