Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-29 Thread Andrus
Hi! A further tweak; add the following to the WHERE clause: AND EXTRACT(DOW FROM times.period) != 0 I changed it to isodow to work in any locale. Your solution is more readable but Erwin answer in SO looks more optimized. I have 10 workes and 1 month reservation with 15 minute offsess from

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Thom Brown
On 28 October 2014 15:10, Andrus kobrule...@hot.ee wrote: Hi! I'm looking for finding ealiest possible start times from reservations table. People work from 10:00AM to 21:00PM in every week day except Sunday and public holidays. Jobs for them are reserved at 15 minute intervals and whole

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Andrus
Hi! Would you be able to adapt this to your needs?: Thank you very much. Great solution. I refactored it as shown below. Query returns only dates for single day. Changing limit clause to 300 does not return next day. How to return other day dates also, excluding sundays and public holidays in

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Thom Brown
On 28 October 2014 19:14, Andrus kobrule...@hot.ee wrote: Hi! Would you be able to adapt this to your needs?: Thank you very much. Great solution. I refactored it as shown below. Query returns only dates for single day. Changing limit clause to 300 does not return next day. How

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Thom Brown
On 28 October 2014 20:04, Thom Brown t...@linux.com wrote: On 28 October 2014 19:14, Andrus kobrule...@hot.ee wrote: Hi! Would you be able to adapt this to your needs?: Thank you very much. Great solution. I refactored it as shown below. Query returns only dates for single day.

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Andrus
Hi! A correction to this. As it stands, it will show times like the following: Thank you. I posted your solution as alternative to Erwin answer in http://stackoverflow.com/questions/26608683/how-to-find-first-free-start-times-from-reservations-in-postgres Andrus.

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-28 Thread Thom Brown
On 28 October 2014 21:07, Andrus kobrule...@hot.ee wrote: Hi! A correction to this. As it stands, it will show times like the following: Thank you. I posted your solution as alternative to Erwin answer in