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;

>From page 33 of Bruce's book, at:

http://www.postgresql.org/docs/aw_pgsql_book/node52.html

Ross
-- 
Ross J. Reedstrom, Ph.D., <[EMAIL PROTECTED]> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

Reply via email to