Ver Mensaje Individual
Antiguo 07-may-2008, 18:42   #3 (permalink)
oscarva
oscarva está en el buen camino
 
Avatar de oscarva
 
Fecha de Ingreso: agosto-2004
Ubicación: Bogota - Colombia
Mensajes: 400
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
oscarva está desconectado   Responder Citando