Need help to write sql query Id is unique. NextID stores the noxt ID value. When NextID
Fantastic news! We've Found the answer you've been seeking!
Question:
Need help to write sql query
Id is unique. NextID stores the noxt ID value. When NextID value is Null, there the path Ends.
Input:
ID NextID
1 5
2 Null
3 6
4 7
5 8
6 9
7 Null
8 Null
9 10
10 Null
Output:
a. 1 --> 5 --> 8
b. 2
C. 3 -->6 -->9 -->10
d. 4-->7
e. 8
Sample scripts:
INSERT Data VALUES ('1','5'), ('2','Null'), ('3','6'), ('4','7'), ('5','8'), ('6','9'), ('7','Null'), ('8','Null'), ('9','10'), ('10','Null')
Related Book For
Business Statistics for Contemporary Decision Making
ISBN: 978-0470910184
6th Edition
Authors: Ken Black
Posted Date: