Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 13 Jan 2004 @ 00:18:52 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


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
;


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023