[SQL] Finding gaps in scheduled events

2006-12-12 Thread Marcin Stępnicki
Hello. I've been struggling with this one for over a week, but for some reason my mind isn't compatibile with the problem - it seems simple, yet I'm unable to find the proper solution :(. I have a timeline divided to 15 minute periods: start | --+ 8:00 | 8:15 | 8:30 | 8:45 | (...)|

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Richard Huxton
Marcin Stępnicki wrote: start | finish | type_id --++ 8:30 | 8:45 |1- type A 9:30 | 10:00 |2- type B I have to deal with the existing schema, but if it can be done in a better way please let me know so I could avoid mistakes in my own programs

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Erik Jones
Richard Huxton wrote: Marcin Stępnicki wrote: start | finish | type_id --++ 8:30 | 8:45 |1- type A 9:30 | 10:00 |2- type B I have to deal with the existing schema, but if it can be done in a better way please let me know so I could avoid mistakes in

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Alvaro Herrera
Marcin Stępnicki wrote: Now I need to create a query to find hours at which each of the type can start. So, if it's event A (which take 15 minutes) it can start at: 8:00 (to 8:15) 8:15 (to 8:30) ( 8:30 to 8:45 is already taken ) 8:45 (to 9:00) 9:00 (to 9:15) 9:15 (to 9:30) ( 9:30 to

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Erik Jones
Alvaro Herrera wrote: Marcin Stępnicki wrote: Now I need to create a query to find hours at which each of the type can start. So, if it's event A (which take 15 minutes) it can start at: 8:00 (to 8:15) 8:15 (to 8:30) ( 8:30 to 8:45 is already taken ) 8:45 (to 9:00) 9:00 (to 9:15) 9:15 (to