| От | Steve Lefevre |
|---|---|
| Тема | Update with aggregate subquery? |
| Дата | |
| Msg-id | 468CF3B0.10309@osu.edu обсуждение исходный текст |
| Ответы |
Re: Update with aggregate subquery?
|
| Список | pgsql-novice |
Hello all - I'm trying to find a way to simply some code, and I have an idea that I can't quite hatch. It might be too complex for SQL. I'm trying to do something like UPDATE first_table SET latitude = ( SELECT avg(lat) FROM another_table GROUP BY another_table.first_table_id WHERE another_table.first_table_id = first_table.id ) Basically I have to refer to the 'outside' table within the subselect -- the 'first_table.id' in the subselect. Is this possible? The added wrinkle is that the table I am selecting from is the same table in a self join! Would that add any problems?
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера