Hi all,

I want to update the values of a column with the
result of a function that requires information
from another table.  Specifically it needs a
minium and maximum value from another table.

How do I perform the update query?

Below is my attempt but it doesn't work.  The
"bhlineid" is my primary key and foreign key in
the 2 tables

UPDATE geo_obs.bhline SET bhline_geom =
CalcBH3dLineMC (minmax.bhlineid,
minmax.srid_original, minmax.from_m, minmax.to_m, 
                        'geo_obs.bhline_surv', 'bhlineid',  'dist_m',
'azim', 'v_inclin',
                        'bhline_surv_geom', 5.0)
        FROM 
(SELECT i.bhlineid AS bhlineid, min(i.from_m) AS
from_m, 
max(i.to_m) AS to_m, max(c.srid_original) AS
srid_original 
FROM geo_obs.bhline_int AS i, geo_obs.bhline AS c 
WHERE c.bhlineid=i.bhlineid 
GROUP BY i.bhlineid) AS minmax

WHERE geo_obs.bhline.bhlineid = minmax.bhlineid ;


Thanks for any help.

Phillip Allen




---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to