Ver Mensaje Individual
  #9 (permalink)  
Antiguo 19/05/2009, 10:23
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: Hacer update que incremente el valor de un campo en funcion de otro campo

Pruebalo así:

Código mysql:
Ver original
  1. ofertas
  2. num_orden=if(
  3. (round(TO_DAYS(ofertas.fechaexpiracion) - TO_DAYS( date( ofertas.fechapublicacion ) ))/7)  between '1'  and '4',(1 + ROUND(RAND() * (5 - 1))),
  4.  
  5. (round(TO_DAYS(ofertas.fechaexpiracion ) - TO_DAYS( date( ofertas.fechapublicacion ) ))/7)  between '4'  and '8',(6 + ROUND(RAND() * (9 - 6))),
  6.  
  7. if((round(TO_DAYS(ofertas.fechaexpiracion ) - TO_DAYS( date( ofertas.fechapublicacion ) ))/7)  between '8'  and '12',(10 + ROUND(RAND() * (15 - 10))),num_orden))
  8.  
  9. id_usuario='927'
  10. estado='1'
  11. (DATE(fechapublicacion) >='2008-10-01' AND DATE(fechapublicacion) <= '2008-10-31')

un saludo.
__________________
Without data, You are another person with an opinion.
W. Edwads Deming

Última edición por huesos52; 19/05/2009 a las 10:35