From: | William Leite Araújo <william(dot)bh(at)gmail(dot)com> |
---|---|
To: | "Renato Cramer" <renato(at)domsis(dot)com(dot)br> |
Cc: | "Pgsql-Sql (E-mail)" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: IF statement in Select |
Date: | 2006-04-05 17:04:21 |
Message-ID: | bc63ad820604051004t52e47e9bq7bb4bec0d460f4b1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
You can use "Case"
SELECT c1, c2, CASE WHEN c3 = 52 THEN 0 ELSE 1 END AS base_irrf_13 FROM
t1;
On 4/5/06, Renato Cramer <renato(at)domsis(dot)com(dot)br> wrote:
>
> Hello all,
>
> Is the use of IF statement restrict to Functions and Store Procedures?
>
> I'm trying to use an IF within Select...
>
> Example:
> create view v1 as
> select c1,
> c2,
> if c3 = 52 then 0
> else 1
> endif as base_irrf_13
> from t1;
>
> Thanks in advance,
>
> Renato Cramer.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
--
William Leite Araújo
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2006-04-05 18:14:42 | Reverse Index ... how to ... |
Previous Message | Renato Cramer | 2006-04-05 16:45:25 | IF statement in Select |