List:General Discussion« Previous MessageNext Message »
From:Scott Haneda Date:June 19 2007 9:55pm
Subject:How do you reference custom column names
View as plain text  
SELECT 1+1 as foo, 2 as bar, foo+bar

This will not work, but I think you can see what I am trying to do.  I need
to run a pretty hefty update on a database, and there are some pretty heavy
calculations I will be doing.  The result of many of those, needs to be
further used to make updates on other columns.

Can someone suggest a method to do this so my SQL is not so non-manageable?

Something like this:

SELECT price*tax_rate+something-other

Then I need to use the result of the above calc right away in some other
field, which would be:

SELECT price*tax_rate+something-other, ((price*tax_rate+something-other)+.6)

Where what I really want to do is:

SELECT price*tax_rate+something-other as foo, (foo+.6)

-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.


Thread
How do you reference custom column namesScott Haneda19 Jun
  • Re: How do you reference custom column namesDan Nelson19 Jun