select count(id) from table group by substring(datestamp(1,10));