Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/02/2004, 12:07
kotosh
 
Fecha de Ingreso: mayo-2002
Mensajes: 486
Antigüedad: 22 años
Puntos: 0
substr en select mysql

Quiero filtrar los datos del campo fecha e imprimir solo los que sean del '2004'

el formato en mi tabla es: 2004-02-07 00:00:00

$anno='2004';
echo $anno;
$result3=mysql_query("select * from stat where SUBSTRING(fecha,1,4)=='$anno'",$link);
while($row3=mysql_fetch_array($result3)){
echo $row3[fecha]."<br>";
}

Gracias por su ayuda
__________________
Sistemass.com - Centro de capacitación profesional
http://www.sistemass.com