Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > Expression on a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3082 of 3160
Post > Topic >>

Expression on an Expression alias

by younicycle@[EMAIL PROTECTED] ("Mike Ellsworth") Apr 18, 2008 at 04:21 PM

I'm wondering if there is a way to write an expression on an
expression alias... or 'build on' an existing expression alias.
I am slowly converting old Filemaker work to PG and the below would be
helpful.
My old Filemaker allows something similar to var 2 below.

This is an example ( a little feeble) where FV is a function
the first one works, but can get lengthy if I start to nest variations.

SELECT
fv_test.acct_val AS acct_val,
fv_test.time AS time,
fv_test.i AS interest_rate,
FV(fv_test.acct_val,fv_test.i,fv_test.time) AS FV1,
FV(fv_test.acct_val,fv_test.i,fv_test.time) *2 AS FV2,
FV(fv_test.acct_val,fv_test.i,fv_test.time) *3 AS FV3
FROM    "hrcommu"."fv_test"

The *effect* I'd like is to 'reuse' FV1, ~

SELECT
fv_test.acct_val AS acct_val,
fv_test.time AS time,
fv_test.i AS interest_rate,
FV(fv_test.acct_val,fv_test.i,fv_test.time) AS FV1,
FV1 *2 AS FV2,
FV1 *3 AS FV3
FROM    "hrcommu"."fv_test"

Any suggested reading, would be read.
Thanks

-- 
Sent via pgsql-novice mailing list (pgsql-novice@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice




 3 Posts in Topic:
Expression on an Expression alias
younicycle@[EMAIL PROTECT  2008-04-18 16:21:42 
Re: Expression on an Expression alias
tgl@[EMAIL PROTECTED] (T  2008-04-18 16:31:57 
Re: Expression on an Expression alias
younicycle@[EMAIL PROTECT  2008-04-18 16:42:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Fri Jul 4 9:35:53 CDT 2008.