On Saturday 15 March 2008 18:05, Frank Bax wrote:
> This is smaller; and should be equivalent:
>
> group_id = 1 AND
> ( res_start_day <= '$date1' AND res_end_day >= '$date1'
> OR
> res_start_day >= '$date1' AND res_start_day < '$date2' )
> [AND region_id = $region_id]
> [AND company_id = $company_
Aarni Ruuhimäki wrote:
So the WHERE clause would go like:
group_id = 1 AND res_start_day < '$date1' AND res_end_day >= '$date1' [AND
region_id = $region_id] [AND company_id = $company_id] [AND product_id =
$product_id]
OR
group_id = 1 AND res_start_day = '$date1' AND res_end_day >= '$date1' [
On Friday 14 March 2008 18:09, Frank Bax wrote:
> >
> > Is zero days/nights, ignored. Not even possible to insert in the
> > application. end_day must be greater than start_day.
>
> You should still consider rows that are "out of range" or "zero nights"
> in your test cases to make sure your report
Aarni Ruuhimäki wrote:
Thanks Frank,
astart_day before period_start, end_day before period_start
This I don't have to care about as it is not in the period we are looking at.
bstart_day = period_start, end_day = period_start
Is zero days/nights, ignored. Not even possible to inser
Aarni Ruuhimäki wrote:
Thanks Steve,
I'm not sure if I quite grasped this. It gives a bit funny results:
SELECT sum ((date_smaller(res_end_day, '2007-12-31'::date) -
date_larger(res_start_day, '2006-12-31'::date)) * group_size) AS
days_in_period,
c.country_name AS country
FROM product_res p
Thanks Frank,
Top and between posting ...
On Friday 14 March 2008 15:58, Frank Bax wrote:
> Frank Bax wrote:
> > Aarni Ruuhimäki wrote:
> >> Anyway, I have to rethink and elaborate the query. I know that it will
> >> usually be on a monthly or yearly basis, but a reservation can
> >> actually be
Frank Bax wrote:
Aarni Ruuhimäki wrote:
Anyway, I have to rethink and elaborate the query. I know that it will
usually be on a monthly or yearly basis, but a reservation can
actually be any of the following in relation to the given (arbitrary)
period:
1. start_day before period_start, end_da
Aarni Ruuhimäki wrote:
Check my work, but I think the sum part of the query simply becomes:
sum (
(
date_smaller(res_end_day, '2008-02-29'::date) -
date_larger(res_start_day, '2008-01-31'::date)
) * group_size
)
Basically remove the "+1" so we don't include both start and end dates
but
>
> Check my work, but I think the sum part of the query simply becomes:
>
> sum (
> (
> date_smaller(res_end_day, '2008-02-29'::date) -
> date_larger(res_start_day, '2008-01-31'::date)
> ) * group_size
> )
>
> Basically remove the "+1" so we don't include both start and end dates
> but mov
Sorry, my bad, I meant 5 days x 4 persons = 20 person-days. From 10 to 15 it
is 5 'days' ? Arrival 10th and departure 15th makes 5 'nights' or 'days',
whatever one might call it, statistical accommodation units.
Likewise, res_id x, start_day some time before Feb 08, end_day 2008-02-16 for
a
This was superfast, thank you !
On Thursday 13 March 2008 20:58, Steve Crawford wrote:
> Aarni Ruuhimäki wrote:
> > res_id 2, start_day 2008-02-10, end_day 2008-02-15, number of persons 4
> >
>
> If you use the same inclusive counting of days for res_id 2, you have 4
> persons (don't know where 5
Aarni Ruuhimäki wrote:
Hi all,
A bit stuck here with something I know I can do with output / loops /
filtering in the (web)application but want to do in SQL or within PostgreSQL.
Simply said, count days of accommodation for a given time period.
E.g.
res_id 1, start_day 2008-01-25, end_day 2
Hi all,
A bit stuck here with something I know I can do with output / loops /
filtering in the (web)application but want to do in SQL or within PostgreSQL.
Simply said, count days of accommodation for a given time period.
E.g.
res_id 1, start_day 2008-01-25, end_day 2008-02-15, number of perso
13 matches
Mail list logo