ERROR: More than one tuple returned by a subselect used as an expression. - Mailing list pgsql-novice

From Mel Jamero
Subject ERROR: More than one tuple returned by a subselect used as an expression.
Date
Msg-id 002301c2f9dc$c2047ab0$1b06a8c0@mel
Whole thread Raw
In response to call analyze from stored procedure in C  (Ulli Mueckstein <ulim@tbi.univie.ac.at>)
Responses Re: ERROR: More than one tuple returned by a subselect used as an expression.  (Josh Berkus <josh@agliodbs.com>)
List pgsql-novice
help!

query is equivalent to "update table1 set field6 = (select table2_field2
from table2 where table2_field5 = table1.field5)"

table2 appears to have many instances of table2_field5.

my question is, how do i reformulate my SQL so that i can update table1 such
that it only gets the first occurrence of table2_field5 on table2 and ignore
all the other occurrences?  is there even a way where only 1 SQL statement
is sufficient to carry out the desired result(s)?

thanks in advance!!!

i hope i stated my question clearly, sorry if i didn't.

mel


pgsql-novice by date:

Previous
From: Ulli Mueckstein
Date:
Subject: call analyze from stored procedure in C
Next
From: Ennio-Sr
Date:
Subject: Toggling 'Expanded display on' (\x) confuses encodings