我想在一个声明中按星期几(我的例子中的星期四)过滤。下一个声明有效(请注意date
是列名):
SELECT CAST (strftime('%w', date) AS Integer) = 4 FROM sales WHERE id=123;
然而,当我包含上述过滤器时,我没有得到任何结果:
SELECT * FROM sales WHERE id=123 AND (SELECT CAST (strftime('%w', date) AS Integer) = 4 FROM sales WHERE id=123) = 1;
答案 0 :(得分:0)
虽然我不知道为什么以前的代码不起作用,但我发布了另一种工作解决方案:
SELECT * FROM sales WHERE id=123 AND CAST (strftime('%w', date) AS Integer) = 4;