| От | Tom Lane |
|---|---|
| Тема | Re: Putting an aggregate value in an UPDATE statement... |
| Дата | |
| Msg-id | 9432.1275426952@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Putting an aggregate value in an UPDATE statement... (John Gage <jsmgage@numericable.fr>) |
| Ответы |
Re: Putting an aggregate value in an UPDATE statement...
|
| Список | pgsql-novice |
John Gage <jsmgage@numericable.fr> writes:
> Thanks. I tried that _without_ the parentheses around the select
> statement and it didn't work.
> At the risk of further displaying ignorance, why are the parens
> necessary, what do they do?
You need them to syntactically separate the sub-select from the outer
select. If SQL didn't require them, then in something like
UPDATE question_choices SET total_rows =
select count(*) from care_lesson where something
it wouldn't be clear whether the WHERE clause was meant to attach
to the sub-select or the outer UPDATE.
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера