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