Round down and group by decade php mysql -
i know stupid question, there simple way round down date format such:
1992-12-11 ( thats in mysql database )
i run query , turn 1992 1990 , group 1990 entries.
i dont know start it, , can seem find decimal rounding etc messy , not work.
if can offer suggestion using mysql , or php appreciate it.
--------- update ------------
$sql_decade = "select date archivals status=1 group year(date) div 10"; $result = mysql_query($sql_decade) or die(mysql_error()); while($r= mysql_fetch_array($result)) { $decade = $r['date']; echo $decade; }
stil not quite rounding down.
just gives me full dates still?
you can perform integer division on year:
group year(date) div 10 -- 1993 becomes 199, etc.
Comments
Post a Comment