Hi, im sure this is pretty simple, but its been a while since i really was involved in any depth with database and asp, at least I wrote some code way back when that did this but dont have it anymore.<BR><BR>I have a database, with table:<BR><BR>CATS<BR>catid: cat: parentid<BR><BR>Then for example I have the following Entries:<BR>catid: cat: parentid<BR>1 Arts & Entertainment 0<BR>2 Clubs & Nightlife 1<BR>3 Nightclubs 2<BR>4 Bars & Pubs 2<BR>5 Comedy Clubs 2<BR>6 General 1<BR>7 GeneralSub2 6<BR>8 GeneralSub3 6<BR><BR><BR>Obviously I have tons more categories but this is for example purposes.<BR><BR>Anyway, I can either, using 2 different codes get the first 2 levels, and no more below, or get say catid 1, 2, and 3, but not 4 and 5, or 6, 7 or 8<BR><BR><BR>im using basic do until loops to test but use getrows in the actual app...<BR>------------- EXCUSE The MESS as Was Back And Forth with code ------<BR>SET rs_sub_cats = conn.EXECUTE("select * from cat where parentid = &#039;" & REQUEST("catid") & "&#039;") <BR>IF NOT rs_sub_cats.EOF THEN <BR>sub_cat = rs_sub_cats("cat")<BR>sub_catid = rs_sub_cats("catid")<BR>get_sub_cats = get_sub_cats & "&#060;a href=""" & REQUEST.ServerVariables("URL") & "?catid=" & rs_sub_cats("catid") & """&#062;" & rs_sub_cats("cat") & "&#060;/a&#062;" & showcnt & "<BR>"<BR>DO<BR>set rs_ci2 = conn.execute("select * from cat where parentid = &#039;" & sub_catid & "&#039;")<BR>if not rs_ci2.eof then<BR>sub_catid = rs_ci2("catid")<BR>sub_cat = rs_ci2("cat")<BR>response.write sub_catid & "<BR>"<BR>response.write "&#060;li&#062;" & sub_cat & "-" & sub_catid & "<BR>"<BR>rs_ci2.movenext<BR>end if<BR>loop until rs_ci2.eof<BR>end If<BR><BR>--------------------RETURNS --------------<BR><BR>select * from cat where parentid = &#039;1&#039;<BR>2<BR><BR>Clubs & Nightlife-2<BR><BR>select * from cat where parentid = &#039;2&#039;<BR>3<BR><BR>Nightclubs-3<BR>select * from cat where parentid = &#039;3&#039;<BR>----------so you see it is not getting the other cats ----<BR><BR>any ideas?<BR><BR>there has to be an easier way, then a bunch of sub loops and for nexts loops etc. There is a way Im doing it now with an extra field called above cats and it is like this -1-2-3 then I just do an Instr() in the SQL select and it is fast, but still, would rather not as that is extra code when adding the record.<BR><BR>thanks<BR><BR>Rory