sqlserver convert() 对日期统计出错 只能比较下限,不能比上限
SELECT COUNT(1)FROM A1WHERE CONVERT(VARCHAR(8),A1.TEST_DATE, 112) >= CONVERT(VARCHAR(8), '2012-06-01', 112) --大于AND CONVERT(VARCHAR(8),A1.TEST_DATE, 112) <= CONVERT(VARCHAR(8), '2012-06-11', 112) --小于
SELECT COUNT(1)FROM A1WHERE CONVERT(VARCHAR(10),A1.TEST_DATE, 112) between CONVERT(VARCHAR(10), '2012-06-01', 112) --大于AND CONVERT(VARCHAR(10), '2012-06-11', 112) --小于
[解决办法]