select DATE_FORMAT(FROM_UNIXTIME(date),'%Y-%m-%d') as d, count(*) as c from tb where (FROM_UNIXTIME(date)) >= (FROM_UNIXTIME('')) and (FROM_UNIXTIME(date)) <= (FROM_UNIXTIME('')) group by d