|
|
Archives of the TeradataForum
Message Posted: Mon, 02 Apr 2007 @ 21:08:41 GMT
Subj: | | Re: Teradata Join condition with case statement |
|
From: | | Jinesh P V |
You could try the following.
sel * from
(sel acc_col_1 as acc_cd, '2A' as acc_id
from A_acc_sp
union all
sel acc_col_2 as acc_cd, '3A' as acc_id
from A_acc_sp
union all
sel acc_col_3 as acc_cd, '4A' as acc_id
from A_acc_sp
union all
sel acc_col_4 as acc_cd, '5A' as acc_id
from A_acc_sp
union all
sel acc_col_5 as acc_cd, '6A' as acc_id
from A_acc_sp
union all
sel acc_col_6 as acc_cd, '7A' as acc_id
from A_acc_sp )A_acc_sp
left join
B_acc_tmp B_acc_tmp
on B_acc_tmp.acc_id = A_acc_sp.acc_id
and B_acc_tmp.acc_cd = A_acc_sp.acc_cd;
thanks,
Jinesh P V
| |