IF..THEN..ELSE

Поиск
Список
Период
Сортировка
От David J. Haglin
Тема IF..THEN..ELSE
Дата
Msg-id 199809171546.KAA21063@pike.cs.mankato.msus.edu
обсуждение исходный текст
Список pgsql-sql
Hello,

I'm kinda new to using PostgreSQL, and am somewhat mystified by
what appears to me to be a lack of a feature.  Specifically, I
would like to be able to use an IF function in a SELECT, such as:

   SELECT key,
          IF (attr1>attr2, attr1, attr2) AS maxOfAttrs
   INTO TABLE temp
   FROM basic;

where the temp database would have a new column holding the larger
of the two attributes for each instance.

Is there an easy way to accomplish this that I am not seeing?

Thanks in advance for any help,

       David

--
David J. Haglin              David.Haglin@mankato.msus.edu
Mankato State University     http://pike.cs.mankato.msus.edu/~haglin
P.O. Box 8400                Voice: (507) 389-5306
Mankato, MN 56002-8400       Fax:  (507) 389-6376

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

Предыдущее
От: Federico Passaro
Дата:
Сообщение: Re: [SQL] Turn autocommit off ?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] Turn autocommit off ?