一开始我向一个表里插入数据时,
用getdate()函数给一个列(registertime)赋了一个datetime类型的数据,
它在数据库里是这样显示的:2010-4-11 22:17:41(举个例子)。现在我想查询列(registertime)的日期,不包括时间,就是查询一天的所有记录。请问这样的select和update各怎样写?
我也写了一个查询语句,但是不能用
select * from table where left(registertime,5) like '(select left(registertime,5) from waybill_d)%'
用这个
select * from table where datediff(dd,registertime,getdate())=0
FROM table
where (DATEPART(year, getdate()) = '2010') and (DATEPART(month, getdate()) = '3') and (DATEPART(day, getdate()) = '12')