Here's a sample table...
create table t1(v1 int, v2 int);
And some sample data...
insert into t1 values(1, 2);
insert into t1 values(2,1);
insert into t1 values(2,100);
insert into t1 values(1,1);
And finally, an example of case when: we want to build a query which
returns the maximum of field v1 and v2 for each row. If the values are
equal, we will just return field v1.
select
case
when v1 > v2 then v1
when v2 > v1 then v2
else v1
end as "themax"
from t1;
It should return...
themax
------
2
2
100
1
(3 rows)
--
---
Damond Walker
Rich Ackerman <richmond@no.shadow.spam.net> wrote in message
news:3819a23a.66190466@news.mia.bellsouth.net...
> Does anyone have any examples of how to use the CASE WHEN? I've been
> looking around and haven't found anything beyond what is in Chap 5 of
> the User's Guide. Thanks for any tips.
>
>