Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6048B9FA4BC for ; Tue, 2 Jan 2007 17:48:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 96221-07 for ; Tue, 2 Jan 2007 17:47:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from socrates.thinkhost.com (mailpipe.socrates.thinkhost.com [64.40.100.194]) by postgresql.org (Postfix) with ESMTP id 91C549FA4BB for ; Tue, 2 Jan 2007 17:47:56 -0400 (AST) Received: from geier (adsl-64-91-71-139-rb.lax.customer.centurytel.net [64.91.71.139]) by socrates.thinkhost.com (8.13.6/8.13.5) with SMTP id l02LllSO021440 for ; Tue, 2 Jan 2007 16:47:48 -0500 (EST) (envelope-from jgeier@apt-cafm.com) From: "Jeanna Geier" To: "Pgsql-Jdbc@Postgresql.Org" Subject: Calculated Fields in Postgres? Date: Tue, 2 Jan 2007 15:47:50 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200701/5 X-Sequence-Number: 16370 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