| От | paallen@attglobal.net |
|---|---|
| Тема | Update Field with function/data from other tables? |
| Дата | |
| Msg-id | 20070406170214.CCB0C9FB53B@postgresql.org обсуждение исходный текст |
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера