Kueri ini memeriksa apakah Anda memiliki @x/5
slot gratis di @x
berikutnya menit. Dan jika demikian, dari mereka mencakup seluruh @x
interval menit, artinya berurutan.
set @x=15;
select distinct t1.date
from
`agenda_specialists` as t1 join
`agenda_specialists` as t2 on
t2.date=t1.date and
t2.begin>=t1.begin and
t2.begin<addtime(t1.begin,sec_to_time(@x*60))
group by t1.id
having count(*)[email protected]/5
http://sqlfiddle.com/#!2/54d9f6/50