Re: conditional insert

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема Re: conditional insert
Дата
Msg-id 4E64A79E.7030503@compulab.co.il
обсуждение исходный текст
Ответ на Re: conditional insert  (Pau Marc Muñoz Torres <paumarc@gmail.com>)
Ответы Re: conditional insert
Список pgsql-general
<meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    body p { margin-bottom: 0cm; margin-top: 0pt; }

  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
    text="#000000">
    On 09/05/2011 01:37 PM, Pau Marc Muñoz Torres wrote:
    <blockquote
cite="mid:CADFuJLi3K0X1A7OwR+9_neWjKCEXtYYyMP_n=x5z=D2+GNCTNw@mail.gmail.com"
      type="cite">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')

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

Предыдущее
От: Pau Marc Muñoz Torres
Дата:
Сообщение: Re: conditional insert
Следующее
От: Pau Marc Muñoz Torres
Дата:
Сообщение: Re: conditional insert