Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id F22D81AF9929 for ; Wed, 8 Feb 2012 22:31:34 -0400 (AST) Received: from sam.nabble.com ([216.139.236.26]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RvJnJ-000193-6c for pgsql-sql@postgresql.org; Thu, 09 Feb 2012 02:31:34 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RvJn5-0002nc-A0 for pgsql-sql@postgresql.org; Wed, 08 Feb 2012 18:31:19 -0800 Date: Wed, 8 Feb 2012 18:31:19 -0800 (PST) From: ssylla To: pgsql-sql@postgresql.org Message-ID: <1328754679303-5468395.post@n5.nabble.com> Subject: update column with multiple values MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.8 (/) X-Archive-Number: 201202/35 X-Sequence-Number: 36328 Dear list, sorry, I already posted this, but it did not seem to have been accepted by the mailing list. So here's my second try: I need to update all rows of a column ('parent') based on a subquery that returns me the first four digits of another column ('id'): UPDATE admin SET parent=(SELECT SUBSTR(id,1,4) FROM admin); After executing, I get the following error-message: "more than one row returned by a subquery used as an expressionmore than one row returned by a subquery used as an expression" I am not quite sure about that, but maybe I need to construct a function/loop to fulfill this task? thanks for help. Stefan -- View this message in context: http://postgresql.1045698.n5.nabble.com/update-column-with-multiple-values-tp5468395p5468395.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com.