From: | "Pau Marc Munoz Torres" <paumarc(at)gmail(dot)com> |
---|---|
To: | |
Cc: | "PgSQL General ML" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: if exists...does it exists for insert statments? |
Date: | 2007-12-11 21:28:50 |
Message-ID: | 19b5841a0712111328j76c87b46m4e4f73acda8aad71@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks, i'll test it tomorrow
pau
2007/12/11, Richard Broersma Jr <rabroersma(at)yahoo(dot)com>:
>
> --- On Tue, 12/11/07, Pau Marc Munoz Torres <paumarc(at)gmail(dot)com> wrote:
> > could i use a sentence similar to the mysql sentence
> >
> > insert if not exist into SP values
> > ('cesp','sp');
> >
> > in postgresql?
>
> Using standard ANSI-SQL the statement could be re-written:
>
> INSERT INTO SP
> SELECT a, b
> FROM VALUES ( 'cesp', 'sp' ) AS tmp( a, b )
> LEFT JOIN Sp
> ON (Sp.col1,Sp.col2)=(tmp.a,tmp.b)
> WHERE (Sp.col1,Sp.col2) IS NULL;
>
> Regards,
> Richard Broersma Jr.
>
--
Pau Marc Muñoz Torres
Laboratori de Biologia Computacional
Institut de Biotecnologia i Biomedicina Vicent
Villar
Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)
telèfon: 93 5812807
Email : paumarc(dot)munoz(at)bioinf(dot)uab(dot)cat
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2007-12-11 22:10:16 | Re: if exists...does it exists for insert statments? |
Previous Message | Ivan Sergio Borgonovo | 2007-12-11 21:25:44 | Re: top posting (was: Hijack!) |