sql >> Base de Datos >  >> RDS >> Mysql

Seleccionar tiempo entre dos veces mysql

No hay una gran manera en cuanto al rendimiento para manejar esto. El where correcto declaración es:

where (start <= end and :time between start and end) or
      (end < start and :time not between end and start)

Por supuesto, no tienes que usar between , puede expandir esto:

where (start <= end and :time >= start and :time <= end) or
      (end < start and (:time <= end or :time >= start))