From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Albrecht Berger <berger1517@gmx.ch>
Cc: pgsql <pgsql-sql@postgresql.org>
Subject: Re: replace null with 0 in subselect ?
Date: Wed, 16 Oct 2002 08:03:43 -0700 (PDT)
Message-ID: <20021016080309.A94982-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <05f001c274fb$e8a5aba0$a07ba8c0@wxp>
On Wed, 16 Oct 2002, Albrecht Berger wrote:
> Hello,
> I have a statement like this :
>
> INSERT INTO tab1 (c1, c2, c3) VALUES (1,2, SELECT MAX(pos)+1 FROM tab2);
Coalesce is your friend. :)
Coalesce((select max(pos)+1 from tab2), 0)
should work.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, berger1517@gmx.ch
Subject: Re: replace null with 0 in subselect ?
In-Reply-To: <20021016080309.A94982-100000@megazone23.bigpanda.com>
* 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