pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-general@postgresql.org
Subject: Re: sql question
Date: Wed, 12 Jul 2000 18:25:35 -0500
Message-ID: <20000712182535.A6848@rice.edu> (raw)
In-Reply-To: <Pine.GSO.4.21.0007121731170.21336-100000@mantaray.cs.indiana.edu>
References: <DD6FD0C9668DD311AA040008C7566E8A0313E537@ntmailc.tandy.com>
	<Pine.GSO.4.21.0007121731170.21336-100000@mantaray.cs.indiana.edu>

On Wed, Jul 12, 2000 at 05:33:09PM -0500, Travis Bauer wrote:
> 
> Let's say I have a table t1 with two fields, x and y.  How do I write an
> sql statement like:
> 
> select x if y>1 else 0 from t1;

SELECT CASE WHEN y>1 THEN x ELSE 0 END FROM t1;



view thread (71+ messages)  latest in thread

Message-ID: <20000712182535.A6848@rice.edu>
Permalink:  ../20000712182535.A6848@rice.edu/
Also on:    postgresql.org/message-id/20000712182535.A6848@rice.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-general@postgresql.org
  Cc: reedstrm@rice.edu
  Subject: Re: sql question
  In-Reply-To: <20000712182535.A6848@rice.edu>
  References: <DD6FD0C9668DD311AA040008C7566E8A0313E537@ntmailc.tandy.com> <Pine.GSO.4.21.0007121731170.21336-100000@mantaray.cs.indiana.edu> <20000712182535.A6848@rice.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