Subject | Re: [firebird-support] case alias |
---|---|
Author | Helen Borrie |
Post date | 2005-05-01T00:00:12Z |
At 07:50 AM 30/04/2005 +0000, you wrote:
you could do this:
Select case
when a.f1 = 0 then 'Result = ' || 'zero from xTbl'
else 'Result = ' || 'not zero from xTbl' end as TTT,
I can't tell from your description quite where the phrase "from xTbl" fits
in, but you get the idea.
./heLen
>hi all;Do you need both of these derived fields? If you just want the second one,
>
>in my sql i use "case when"
>
> case when a.f1 = 0 then 'zero' else 'not zero' end as TTT
>
>i want to use this result of case in another field
>I must write again "case" statement..
>
>"Select case when a.f1 = 0 then 'zero' else 'not zero' end as TTT,
>'Result = ' || (case when a.f1 = 0 then 'zero' else 'not zero' end)
>from xTbl"
>
>but i don't want use it like this.. When i've a lot of "case"
>statements my sql is growing..
>
>I want like this..
> "Select case when a.f1 = 0 then 'zero' else 'not zero' end as TTT,
> 'Result = ' || TTT from xTbl"
>
>can I do it?
you could do this:
Select case
when a.f1 = 0 then 'Result = ' || 'zero from xTbl'
else 'Result = ' || 'not zero from xTbl' end as TTT,
I can't tell from your description quite where the phrase "from xTbl" fits
in, but you get the idea.
./heLen