IF..THEN..ELSE - Mailing list pgsql-sql

From David J. Haglin
Subject IF..THEN..ELSE
Date
Msg-id 199809171546.KAA21063@pike.cs.mankato.msus.edu
Whole thread Raw
List 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 by date:

Previous
From: Federico Passaro
Date:
Subject: Re: [SQL] Turn autocommit off ?
Next
From: Bruce Momjian
Date:
Subject: Re: [SQL] Turn autocommit off ?