sqlite用java获取本周数据,使用SQLite获取本周的数据

博主在尝试从SQLite数据库中获取本周的数据时遇到了错误。他们目前的查询只匹配到日期为今天的情况。解决方案是修改查询,使其包含从本周开始至今的所有数据。正确的方法是使用大于等于(>=)运算符来筛选本周范围内的记录。
摘要由CSDN通过智能技术生成

I am trying to get this week's data in sqlite but it seems that I have missed something as i get wrong information back. To be more specific i want to retrieve all the data in my database that have a timestamp which its date falls in this week. This week may either start from Sunday or Monday i.e 26/2/12-03/03/12. At the moment I am using something like this: SELECT * FROM myTable WHERE DATE(timeStamp) == DATE('now', 'weekday 0', '-7 days')

解决方案

I think you should be pretty close. If you want everything since the start of this week, just a slight modification:

SELECT * FROM myTable WHERE DATE(timeStamp) >= DATE('now', 'weekday 0', '-7 days');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值