Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursive Function

Status
Not open for further replies.

xenomage

Programmer
Jun 27, 2001
98
SG
Hi all,

i need to write a recursive loop in asp.

i have a adodb table that is like this...

id parentid
1 0
2 0
3 0
4 0
5 1
6 1
7 2
8 4
9 5
10 5

i need to get the terminal ids(id which is not a parent id of any id) of the table..

please help

many thanks.

xeno
 
Hello,
Try using nested query

"select id from tblParents where id not in (select parentid from tblParents)"

select parentid from tblParents will return a set of all parentid.

"id not in" above set will return all ids that are not in set of parentid - that you need.

D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top