Subject | Re: [firebird-support] CASE WHEN error |
---|---|
Author | Esra Ozdemir |
Post date | 2006-11-25T15:30:07Z |
Hello again :)
I'm so sorry for taking your time Helen and Svein.
I'm using Firebird v1.5 and SQL Dialect:3.
Please check the amended code below:
select DISTINCT
h.HESAP_ID,
h.HESAP_TARIHI,
h.hesap_sec_ tablo,
h.HESAP_SEC_ TAB_ID,
CASE when h.hesap_sec_tablo = 0
then
(select trim(pk.PER_ISIM) ||' '||trim(pk.PER_SADI)
from personel_kart pk
where pk.per_id=h.hesap_sec_tab_id)
else
(select trim(mk.MUS_ISIM) ||' '||trim(mk.MUS_SADI)
from musteri_karti mk
where mk.mus_id =h.hesap_sec_tab_id)
end as kisi,
h.hesap_aciklama,
h.hesap_dekonttur,
h.HESAP_TUR_ ID,
h.hesap_debit,
h.hesap_credit,
case when h.hesap_sec_ tablo = 0 then 'P' Else 'M' end as ST
from hesaplar h
If I can the write same code with "IF/ELSE" statement instead of "CASE WHEN", would it give me the same result that I want?
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
[Non-text portions of this message have been removed]
I'm so sorry for taking your time Helen and Svein.
I'm using Firebird v1.5 and SQL Dialect:3.
Please check the amended code below:
select DISTINCT
h.HESAP_ID,
h.HESAP_TARIHI,
h.hesap_sec_ tablo,
h.HESAP_SEC_ TAB_ID,
CASE when h.hesap_sec_tablo = 0
then
(select trim(pk.PER_ISIM) ||' '||trim(pk.PER_SADI)
from personel_kart pk
where pk.per_id=h.hesap_sec_tab_id)
else
(select trim(mk.MUS_ISIM) ||' '||trim(mk.MUS_SADI)
from musteri_karti mk
where mk.mus_id =h.hesap_sec_tab_id)
end as kisi,
h.hesap_aciklama,
h.hesap_dekonttur,
h.HESAP_TUR_ ID,
h.hesap_debit,
h.hesap_credit,
case when h.hesap_sec_ tablo = 0 then 'P' Else 'M' end as ST
from hesaplar h
If I can the write same code with "IF/ELSE" statement instead of "CASE WHEN", would it give me the same result that I want?
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
[Non-text portions of this message have been removed]