pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christof Glaser <gcg@gl.aser.de>
To: Frank Joerdens <frank@joerdens.de>
To: pgsql-sql@postgresql.org
Subject: Re: Subqueries in Non-SELECT Queries
Date: Sun, 17 Dec 2000 19:32:50 +0100
Message-ID: <00121719325000.15220@pinguin> (raw)
In-Reply-To: <3A3CFFF9.3615E576@joerdens.de>
References: <3A3CFFF9.3615E576@joerdens.de>

Frank Joerdens wrote:

> mpi=# update index set level = 2 where parentid = ( select id from
> index where level = 1 );
> ERROR:  More than one tuple returned by a subselect used as an
> expression. mpi=#
>
> This is a recursive query, on a single table. Is that not possible?

Hi Frank,

as the error message says, the subselect must return only one value,
since the where clause compares just one field for equality. You might 
try IN instead of =, ie

update index set level = 2 where parentid in ( select id from
index where level = 1 );

Hope that helps.

Christof
-- 
          gl.aser . software engineering . internet service
       http://gl.aser.de/  . Planckstraße 7 . D-39104 Magdeburg
Tel. +49.391.7 44 77 10 . Fax +49.391.7 44 77 13 . Mobil 0177.77 92 84 3



view thread (4+ messages)  latest in thread

Message-ID: <00121719325000.15220@pinguin>
Permalink:  ../00121719325000.15220@pinguin/
Also on:    postgresql.org/message-id/00121719325000.15220@pinguin

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gcg@gl.aser.de, frank@joerdens.de
  Subject: Re: Subqueries in Non-SELECT Queries
  In-Reply-To: <00121719325000.15220@pinguin>
  References: <3A3CFFF9.3615E576@joerdens.de> <00121719325000.15220@pinguin>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox