Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/02/2010, 14:43
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: consulta restando

Mira este ejemplo

Código MySQL:
Ver original
  1. mysql> select *from limite5;
  2. +------+
  3. | hola |
  4. +------+
  5. | 1970 |
  6. | 1972 |
  7. | 1985 |
  8. | 1989 |
  9. +------+
  10. 4 rows in set (0.00 sec)
  11.  
  12. mysql> select *from limite5 where hola between (1970-5) and (1970+5);
  13. +------+
  14. | hola |
  15. +------+
  16. | 1970 |
  17. | 1972 |
  18. +------+
  19. 2 rows in set (0.00 sec)
  20.  
  21. mysql> select *from limite5 where hola between (1980-5) and (1980+5);
  22. +------+
  23. | hola |
  24. +------+
  25. | 1985 |
  26. +------+
  27. 1 row in set (0.00 sec)
  28.  
  29. mysql> select *from limite5 where hola between (1990-5) and (1990+5);
  30. +------+
  31. | hola |
  32. +------+
  33. | 1985 |
  34. | 1989 |
  35. +------+
  36. 2 rows in set (0.00 sec)

Donde se muestran los años 1970, 1980 y 1990 sería el dato de entrada a comparar.

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