From: | Pau Marc Muñoz Torres <paumarc(at)gmail(dot)com> |
---|---|
To: | Sim Zacks <sim(at)compulab(dot)co(dot)il> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: conditional insert |
Date: | 2011-09-05 10:47:15 |
Message-ID: | CADFuJLjfHUMEuYTPKgG6GtJMfzJeeq3-bkt162RywRVqc7OYgg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ok , thanks Sim, now i see it
P
2011/9/5 Sim Zacks <sim(at)compulab(dot)co(dot)il>
> **
> On 09/05/2011 01:37 PM, Pau Marc Muñoz Torres wrote:
>
> i don't see it clear, let me put an example
>
> i got the following table
>
> molec varchar(30)
> seq varchar(100)
>
> where I insert my values
>
> lets image that i have a record introduced as ('ubq', 'aadgylpittrs')
>
> how i can prevent to insert another record where molec='ubq' ?
>
> thanks
>
> Either put a unique constraint on molec or do
> insert into tbl(molec,seq)
> select 'ubq', 'aadgylpittrs' where not exists(select molec from tbl where
> molec='ubq')
>
--
*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: (+34)935 86 89 39*
Email : paumarc(dot)munoz(at)bioinf(dot)uab(dot)cat*
From | Date | Subject | |
---|---|---|---|
Next Message | J. Hondius | 2011-09-05 11:02:29 | Re: conditional insert |
Previous Message | Sim Zacks | 2011-09-05 10:42:38 | Re: conditional insert |