From: Jeanna Geier <jgeier@apt-cafm.com>
To: Pgsql-Jdbc@Postgresql.Org <pgsql-jdbc@postgresql.org>
Subject: Calculated Fields in Postgres?
Date: Tue, 2 Jan 2007 15:47:50 -0600
Message-ID: <FBEGJLLJBCOMCDBJHIMEIEEECCAA.jgeier@apt-cafm.com> (raw)
Hello List!
Still trying to learn Postgres... =) I have a question on how/where to
define a calculated field in a table...
Let's say I have a 'Replacement Cost' table with the following fields:
Original Cost
Original Date
Life Expectancy
Life Units
and I want to add a 'Mfg. Replace Date' field, which is a calculated field
with the following formula:
IF ('Life Units' = NAV)
THEN (NAV)
ELSE
( IF ('Life Units' = 'Day(s)'')
THEN (AddDate('Original Date,0,0,'Life Expectancy'))
ELSE
( IF 'Life Units' = 'Month(s)'')
THEN (AddDate('Original Date',0,'Life Expectancy',0))
ELSE
( IF 'Life Units' = 'Year(s)'')
THEN (AddDate('Original Date','Life Expectancy',0.0))
ELSE
(today))))
--------------------------------------------------------
How/where do I define this calculated field?
Any help or guidance that anyone could provide will be greatly appreciated!
If any more information is necessary from my end, please let me know.
Thanks,
-Jeanna
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: jgeier@apt-cafm.com
Subject: Re: Calculated Fields in Postgres?
In-Reply-To: <FBEGJLLJBCOMCDBJHIMEIEEECCAA.jgeier@apt-cafm.com>
References: <FBEGJLLJBCOMCDBJHIMEIEEECCAA.jgeier@apt-cafm.com>
* 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