pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David J. Haglin <haglin@pike.cs.mankato.msus.edu>
To: pgsql-sql@postgresql.org
Subject: IF..THEN..ELSE
Date: Thu, 17 Sep 1998 10:46:17 -0500 (CDT)
Message-ID: <199809171546.KAA21063@pike.cs.mankato.msus.edu> (raw)

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

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



Message-ID: <199809171546.KAA21063@pike.cs.mankato.msus.edu>
Permalink:  ../199809171546.KAA21063@pike.cs.mankato.msus.edu/
Also on:    postgresql.org/message-id/199809171546.KAA21063@pike.cs.mankato.msus.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: haglin@pike.cs.mankato.msus.edu
  Subject: Re: IF..THEN..ELSE
  In-Reply-To: <199809171546.KAA21063@pike.cs.mankato.msus.edu>
  References: <199809171546.KAA21063@pike.cs.mankato.msus.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox