日期:2014-05-18  浏览次数:20765 次

sql2000 查询时间问题
我在查询时间取2012-05-07至2012-05-19的时间信息,却取出了两条4月19日的信息,
student 表数据如下
id name sub_time
1 张三 2012-04-19 17:19:57.660
2 李四 2012-04-19 17:31:44.700
3 董莉 2012-05-17 19:08:10.260
4 莫小三 2012-05-19 10:06:11.363
查询语句
select * from student
where convert(varchar(12),res_subdate,105) between '17-05-2012' and '19-05-2012';
查询结果集里却出现了张三和李四的记录。。很纳闷,向高手们请教了。

------解决方案--------------------
select * from student
where sub_time between '2012-05-07' and '2012-05-19';
要写时间就好好写,干嘛要反过来,不学好