Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/05/2008, 17:42
Avatar de oscarva
oscarva
 
Fecha de Ingreso: agosto-2004
Ubicación: Bogota - Colombia
Mensajes: 425
Antigüedad: 20 años, 6 meses
Puntos: 2
Re: Ordernar datos teniendo en cuenta la fecha y x dias pasados.

Gracias nano por tu respuesta, bueno te cuento que no me da resultado, la ejecuto tal como tu me dices:

Código PHP:
select fechaTIMEDIFF(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),DATE_FORMAT(fecha,'%Y-%m-%d %H:%i:%s')) as Minutosnow() as HORA_ACTUAL
from noticias
where estado
='1' AND TIMEDIFF(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),DATE_FORMAT(fecha,'%Y-%m-%d %H:%i:%s')) = '168:00:00' ORDER BY fecha DESC 
pero de esta forma no me tira ningun error ni tampoco ningun resultado.

ahora le quite el where estado='1' quedandome asi la llamada:

Código PHP:
select fechaTIMEDIFF(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),DATE_FORMAT(fecha,'%Y-%m-%d %H:%i:%s')) as Minutosnow() as HORA_ACTUAL
from pornoticias 
AND TIMEDIFF(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),DATE_FORMAT(fecha,'%Y-%m-%d %H:%i:%s')) = '168:00:00' ORDER BY fecha DESC 
y me tira el siguiente error:

Código:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND TIMEDIFF(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),DATE_FORMAT(

Un saludo y gracias