Re: [SQL] Unique Constraint Based on Date Range

2003-09-22 Thread Manfred Koizar
On Sat, 20 Sep 2003 18:55:34 -0400, Kevin Houle <[EMAIL PROTECTED]> wrote: > SELECT INTO result * FROM table_rates WHERE > effective_date >= NEW.effective_date AND > expiry_date <= NEW.expiry_date AND > cost = NEW.cost; > IF FOUND THEN >RAISE EXCEPTION ''record ove

Re: [SQL] Unique Constraint Based on Date Range

2003-09-21 Thread Kevin Houle
Andrew Milne wrote: ... create table rates ( effective_date AS timestamp, expiry_date AS timestamp, cost AS numeric (12,2), access_time AS integer (in minutes) ); So for a given cost, there may not be a record where the effective date of one record overlaps the expiry date of anothe

[SQL] Unique Constraint Based on Date Range

2003-09-20 Thread Andrew Milne
I'm looking to apply a unique constraint to a table such that field A must be unique based on the date range from Field B to Field C. This is for a rate based service model whereby, for example, $5 is worth 1 hour of Internet access. But next week, because of increased competition, $5 is wort