Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/03/2010, 08:07
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 3 meses
Puntos: 360
Respuesta: crear consulta de horarios de citas 8, 8:30, 9, 9:30 etc

haciendo un ejemplo creo que esto te puede servir

Tienes una tabla con los siguietes registros

Código MySQL:
Ver original
  1. mysql> select *from ejemplo_rango order by hora;
  2. +----------+
  3. | hora     |
  4. +----------+
  5. | 07:30:00 |
  6. | 08:00:00 |
  7. | 08:15:00 |
  8. | 08:30:00 |
  9. | 08:45:00 |
  10. | 09:00:00 |
  11. | 09:15:00 |
  12. | 09:30:00 |
  13. | 14:15:00 |
  14. | 14:30:00 |
  15. | 15:00:00 |
  16. | 16:30:00 |
  17. | 17:30:00 |
  18. | 18:30:00 |
  19. +----------+
  20. 14 rows in set (0.00 sec)

Con esta consulta creo obtienes la salida que esperas
Código MySQL:
Ver original
  1. mysql> select hora from ejemplo_rango where (hora between '08:00' and '15:00') and minute(hora) in('00','30') order by hora;
  2. +----------+
  3. | hora     |
  4. +----------+
  5. | 08:00:00 |
  6. | 08:30:00 |
  7. | 09:00:00 |
  8. | 09:30:00 |
  9. | 14:30:00 |
  10. | 15:00:00 |
  11. +----------+
  12. 6 rows in set (0.02 sec)
__________________
Without data, You are another person with an opinion.
W. Edwads Deming