Re: Conditional SQL query

Поиск
Список
Период
Сортировка
От Indraneel Majumdar
Тема Re: Conditional SQL query
Дата
Msg-id Pine.SGI.3.96.1001106015029.1002323A-100000@www.cdfd.org.in
обсуждение исходный текст
Ответ на Re: Conditional SQL query  ("Cristóvão B. B. Dalla Costa"<cdallacosta@bigfoot.com>)
Ответы Re: Conditional SQL query  (Indraneel Majumdar <indraneel@www.cdfd.org.in>)
Список pgsql-sql
I finally got it to work. you can't use the parentheses. eg:

insert into table select x,x,x where col1 = 'value';
and not
insert into table select (x,x,x) where col1 = 'value';

the latter gives a
ERROR:  parser: parse error at or near "where"
I am using PostgreSQL-7.0.2

Now I have one more problem. How do I insert only once if value does not
exist? eg:

insert into table once select x,x,x where not col1='value'

Thanks,
Indraneel

On Sun, 5 Nov 2000, Cristóvão B. B. Dalla Costa wrote:

> > > insert into table select ... where col1 = 'value'
> > > 
> > 
> > this is working but I am inserting values directly and not by select. eg:
> > 
> > insert into table values(x,x,x)
> > and not
> > insert into table select * from table2
> > 
> 
> insert into table select (x, x, x) where col1 = 'value'
> 

/************************************************************************.
# Indraneel Majumdar                  ¡  E-mail: indraneel@123india.com  #
# Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
# Centre for DNA Fingerprinting and Diagnostics,                         #
# Hyderabad, India - 500076                                              #
`************************************************************************/



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

Предыдущее
От: "Cristóvão B. B. Dalla Costa"
Дата:
Сообщение: Re: Conditional SQL query
Следующее
От: "Cristóvão B. B. Dalla Costa"
Дата:
Сообщение: Re: Conditional SQL query