Re: conditional insert

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: conditional insert
Date: 2011-09-05 09:51:17
Message-ID: j4261h$lj8$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pau Marc Muñoz Torres, 05.09.2011 11:38:
> Hi follk
>
> i trying to performe a conditional insert into a table, indeed, what i'm trying to do is not insert a record into the table if that record exist
>
> googleling i found something like
>
> insert into XX values (1,2,3) where not exist (select ....);
>
> but i'm having and error near where...
> anyone knows how do i can perfome this insert?

INSERT INTO xxx
SELECT 1,2,3
WHERE NOT EXISTS (SELECT ...)

Regards
Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2011-09-05 10:28:20 Re: conditional insert
Previous Message Raymond O'Donnell 2011-09-05 09:48:44 Re: conditional insert