Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 13 Oct 2015 @ 19:21:00 GMT


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


Subj:   Unique String sequence
 
From:   Anomy Anom

<-- Anonymously Posted: Tuesday, October 13, 2015 14:18 -->

Hi,

I was wondering if anyone could give me a pointer in how to resolve this SQL problem.

I have a text string of a fixed length and I need to know when subsequent characters in the string change and in what order.

For example,

     111122244411

would return

     1st = 1
     2nd = 2
     3rd = 4
     4th = 1

and

     11111111111

would return

     1st = 1

I was thinking of a solution where I transpose each character into a row with a corresponding sequence and then looking for the order of change using a window() function, however that would take multiple steps.

We are on Teradata V15.0.


Any suggestions appreciated.

thanks



     
  <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