Re: replace null with 0 in subselect ?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: replace null with 0 in subselect ?
Дата
Msg-id 20021016080309.A94982-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на replace null with 0 in subselect ?  ("Albrecht Berger" <berger1517@gmx.ch>)
Ответы Re: replace null with 0 in subselect ?
Список pgsql-sql
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.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: set difference
Следующее
От: Charles Hauser
Дата:
Сообщение: Use of reference table ('look-up-table') and FK constraint