select convert(varchar(10),createdate,120)ftime,count(0)fcount from tcomplaint
where siteid=$siteid$ and ftype=$ftype$ and year(createdate)=$fyear$ and month(createdate)=$fmonth$
group by convert(varchar(10),createdate,120)