From: | "David Johnston" <polobo(at)yahoo(dot)com> |
---|---|
To: | "'David Salisbury'" <salisbury(at)globe(dot)gov>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: sql or pgsql question, accessing a created value |
Date: | 2011-07-11 19:55:21 |
Message-ID: | 018d01cc4004$77be9f90$673bdeb0$@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
select my_function( timeofmeasurement, longitude ) as solarnoon,
extract(epoch from ( timeofmeasurement - solarnoon ) as solardiff
( case when solardiff < 3600 then 'Y' else 'N' end ) as
within_solar_hour from
my_table;
But I get an error along the lines of
ERROR: column "solarnoon" does not exist LINE 8: extract(epoch from
(timeofmeasurement - solarnoon) ) as sola...
It's probably a compile-time run-time sort of chicken and egg thing. ;)
>>>>>>>>>>>>>>>>>>>>>>>>>
It is. You need to use sub-selects.
SELECT solarnoon, solardiff, CASE... AS within_solar_hour
FROM
SELECT solarnoon, func() AS solardiff
FROM (
SELECT func() AS solarnoon
) AS sn -- close solarnoon from
) AS sd -- close solardiff from
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2011-07-11 20:00:57 | Re: sql or pgsql question, accessing a created value |
Previous Message | Gauthier, Dave | 2011-07-11 19:50:45 | Interesting article, Facebook woes using MySQL |