当我给出选择日期('现在','月初')时,sqlite会返回当月的第一天,但是当我尝试时
select * from mytable where trandate in ( select date(;now', 'start of day'))
它不会返回当天所有数据ID的行。 我用的时候 select * from mutable where trandate = 20140401,它正确返回。但我想询问我不知道的日期
e.g。
SELECT *
FROM mytable
WHERE trandate IN (
SELECT date(;
now', '-9 years', '+5 days'))
在这种情况下,我不知道哪个日期将是9年后+ 5天 请告诉我如何在搜索条件
中使用上述修饰符查询日期答案 0 :(得分:1)
语法是“月初”,而不是“一天的开始”:
select *
from mytable
where trandate in ( select date('now', 'start of month'));
我假设您知道您不需要子选择:
select *
from mytable
where trandate = date('now', 'start of month');