|
|
Archives of the TeradataForum
Message Posted: Mon, 13 Jan 2004 @ 00:18:52 GMT
Subj: | | Re: How to concatenate the column values |
|
From: | | Jim Downey |
I didn't test this but it should give you enough.... This ranks the C2 values by your given C1 value.
Sel C1
, coalesce(C2A,'')||coalesce(C2B,'')||coalesce(C2C,'')
From
(
Sel C1
, max(Case when TheRank=1 then C2 else NULL End) As C2A
, max(Case when TheRank=2 then C2 else NULL End) As C2B
, max(Case when TheRank=3 then C2 else NULL End) As C2C
From
(
Sel C1
, Rank(C2)(Named TheRank)
, C2
From BT
) T2
Group by 1
) T3
Group by 1
;
| |