Re: generated dates from record dates - suggestions

From: "Oliveiros d'Azevedo Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: "Gary Stainburn" <gary(dot)stainburn(at)ringways(dot)co(dot)uk>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: generated dates from record dates - suggestions
Date: 2012-08-20 14:19:58
Message-ID: 90C447DC256446F3A7143ECD343F17C0@marktestcr.marktest.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

With a CASE ... WHEN statement?

Best,
Oliver

----- Original Message -----
From: "Gary Stainburn" <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Monday, August 20, 2012 1:17 PM
Subject: [SQL] generated dates from record dates - suggestions

> Hi folks.
>
> I've got a table with three dates which are populated from an external
> source.
> I then want to have a view with two calculated dates in it, e.g.
>
> if date_1 is null and date_2 is null then date_a=NULL
> if date_1 is not null and date 2 is null then date_a=date_1+'90 days'
> if date_1 > date3 rhen date_b=date1 else date_b=date2
> etc.
>
> What's the best way to do this?
>
> I know it's a quite open question but I'm interested to hear different
> responses
>
>
> --
> Gary Stainburn
> Group I.T. Manager
> Ringways Garages
> http://www.ringways.co.uk
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2012-08-21 10:31:49 Re: generated dates from record dates - suggestions
Previous Message Gary Stainburn 2012-08-20 12:17:46 generated dates from record dates - suggestions