How to do a SELECT with CONVERT or CAST in the WHERE clause using sequelize

1

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?

    
asked by anonymous 22.09.2017 / 21:08

0 answers