SQL笔记:查询当日数据

txtsql="select count(*)  from seekfor where datediff(day,sf_date,getdate())=0"
txtsql="select count(*)  from seekfor where sf_date>=convert(char(10),getdate(),120) and sf_date<convert(char(10),getdate()+1,120)"

这两句都是查询当天数据量的

由于在字段上使用了函数,第一句效率要低些.

 

txtsql="select count(*)  from seekfor where datediff(day,sf_date,getdate())=0"
txtsql="select count(*)  from seekfor where sf_date>=convert(char(10),getdate(),120) and sf_date<convert(char(10),getdate()+1,120)"

这两句都是查询当天数据量的

由于在字段上使用了函数,第一句效率要低些.