[英]convert sql query to sequelize query
how to convert this to sequelize query.如何将其转换为续集查询。 I've tried using between but it does not have the same result.我试过使用 between,但结果不一样。 I dont think between is the solution, how about lte and gte?我不认为之间是解决方案,lte和gte怎么样? Thank you谢谢
where: {
createdAt: {
[Op.between]: ["2018-07-08T14:06:48.000Z", "2019-10-08T22:33:54.000Z"]
}
}
SELECT * FROM testtable WHERE createdAt >= '2020-06-15 00:00:00' AND createdAt <= '2020-06-18 00:00:00'
You can include the same property more than once within the where
and this would work like AND
in your SQL query:您可以在where
多次包含相同的属性,这将像您的 SQL 查询中的AND
一样工作:
where: {
createdAt: { [Op.gte]: '2020-06-15' },
createdAt: { [Op.lte]: '2020-06-18' }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.