pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: pgsql-sql@postgresql.org
Subject: generated dates from record dates - suggestions
Date: Mon, 20 Aug 2012 13:17:46 +0100
Message-ID: <201208201317.46588.gary.stainburn@ringways.co.uk> (raw)

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 




view thread (6+ messages)  latest in thread

Message-ID: <201208201317.46588.gary.stainburn@ringways.co.uk>
Permalink:  ../201208201317.46588.gary.stainburn@ringways.co.uk/
Also on:    postgresql.org/message-id/201208201317.46588.gary.stainburn@ringways.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gary.stainburn@ringways.co.uk
  Subject: Re: generated dates from record dates - suggestions
  In-Reply-To: <201208201317.46588.gary.stainburn@ringways.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox