1

I got a table with the user name and their guarantor. I want to select the record based on 1 name and follow by the guarantor and continue search next record based on this guarantor's guarantor.

=========================
Name        | ParentName
=========================
Ali         | Abu
Bola        | Ali
Cat         | Bola
Danny       | Cat
Dog         | Elephant
=========================

When I put in Danny to the parameter, my expected result will be :

=========
Name
=========
Danny
Cat
Bola
Ali
=========

Is there any possibility to done it with query?

Arulkumar
  • 12,966
  • 14
  • 47
  • 68
tmzs01
  • 11
  • 1

1 Answers1

0

Yes, you can do it! You need to create a recursive query using functions/procedures.

Read here

Community
  • 1
  • 1
granmirupa
  • 2,780
  • 16
  • 27