select count(0) fcount, convert(varchar(10), createdate, 120) fdate
from tattachment_downlog
where siteid =$siteid$ and convert (varchar (10)
    , createdate
    , 120)>=$fbegdate$ and convert (varchar (10)
    , createdate
    , 120)<=$fenddate$
group by convert (varchar (10), createdate, 120)