我开发了一个查询
select accountname count(transactions)
from table1 group by accountname
where date between '27-mar-2012' and '27-jan-2013'
但它给出了所有交易而不考虑和运算符之间,即它正在考虑从一月到十二月的所有值。我的表包含日期列值,例如 27-mar-2012 ...
如果我使用
select accountname count(transactions) from table1
group by accountname
where date between cast('27-mar-2012' as date) and cast( '27-jan-2013' as date)
我得到错误的结果。
我该如何解决?