Recursive logic

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
andy269
Participant
Posts: 1
Joined: Sun May 22, 2011 9:31 pm

Recursive logic

Post by andy269 »

Hello,

I am trying to come up with a recursive SQL logic for the following input. The recursive logic has to be repeated for a subset of the same data, until it finds all possible combinations. C2 should be = C3 and the data has to be consecutive to get the expected result

Database is Teradata.

Example1:- (C - Column)
C1,C2,C3
k,1,2
k,2,3
k,3,4

Expected Output:-
C1,C2,C3
k,1,4

Example2:- (C - Column)
C1,C2,C3
k,1,2
k,3,4
k,4,5
k,6,7
k,7,8

Expected Output:-
C1,C2,C3
k,3,5
k,6,8
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. A Search here for "recursive" should find you a few examples.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply