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
I have a inventory system design in which I would like some help with to
see if it's efficient. The products are broken into:
Product tables
Property tables
Configurable Products - this would include colors (i.e. - black, blue
and green) tied to products
I'm thinking of breaking inventory in
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