假如 rentdetail表 有个Code(单号),rndate(时间字段),该字段的记录如下:
2005-08-14 07:30:56.000
2005-08-14 06:45:56.000
2005-08-15 09:30:56.000
2005-08-15 08:53:56.000
2005-08-16 01:30:56.000
2005-08-16 04:30:56.000
目的:求记录时间等于当天的记录数?
我的写法是这样的
select count(code) from rentdetail 
where convert(char(10),rndate,112)=convert(char(10),getdate(),112)
请问上面语句汇总老是为0,请问是怎么回事??应该如何写?