<% catName = "" scatName = "" I = 1 If mysql then strsql = "SELECT tbCat.catID AS ID1st, tbCat.catName AS Name1st, tbCat.ads AS Ads1st, tbscat.sCatID AS ID2nd, tbscat.scatName AS Name2nd, tbscat.ads AS Ads2nd, tb3ID.sCatID AS ID3rd, tb3ID.scatName AS Name3rd, tb3ID.ads AS Ads3rd " strsql = strsql & "FROM " & tablPfx & "Cat AS tbCat " strsql = strsql & "LEFT JOIN " & tablPfx & "Scat AS tbscat ON tbscat.catID = tbCat.catID " strsql = strsql & "LEFT JOIN " & tablPfx & "Scat AS tb3ID ON tb3ID.catID = tbscat.sCatID " strsql = strsql & "ORDER BY tbCat.catName, tbscat.scatName, tb3ID.scatName;" Else strsql = "SELECT tbCat.catID AS ID1st, tbCat.catName AS Name1st, tbCat.ads AS Ads1st, tbscat.sCatID AS ID2nd, tbscat.scatName AS Name2nd, tbscat.ads AS Ads2nd, tb3ID.sCatID AS ID3rd, tb3ID.scatName AS Name3rd, tb3ID.ads AS Ads3rd " strsql = strsql & "FROM " & tablPfx & "Cat AS tbCat " strsql = strsql & "LEFT JOIN (" & tablPfx & "Scat AS tbscat LEFT JOIN " & tablPfx & "Scat AS tb3ID ON tb3ID.catID = tbscat.sCatID) " strsql = strsql & "ON tbscat.catID = tbCat.catID " strsql = strsql & "ORDER BY tbCat.catName, tbscat.scatName, tb3ID.scatName;" End If Set rsCat = objConn.Execute(strsql) If not rsCat.EOF then Response.Write vbcrlf & "
" & vbcrlf Do while not rsCat.EOF currcatName = rsCat("Name1st") currscatName = rsCat("Name2nd") currcat3rdName = rsCat("Name3rd") If currcatName <> catName then catName = currcatName catID = rsCat("ID1st") ads = rsCat("Ads1st") If firstCatFound then Response.Write "
 
" If I mod 3 = 0 then Response.Write "" & vbcrlf I = I + 1 End If If I mod 3 = 1 then Response.Write "" & vbcrlf Response.Write "" & vbcrlf Response.Write "" & vbcrlf Response.Write "" & vbcrlf Response.Write "" & catName & " [" & ads & "]" Response.Write "

" firstCatFound = True End If If currscatName <> scatName then scatName = currscatName sCatID = rsCat("ID2nd") sads = rsCat("Ads2nd") Response.Write "" End If rsCat.MoveNext Loop Response.Write "
  • " & scatName & " [" & sads & "]" End If If Len(currcat3rdName) > 0 then cat3rdID = rsCat("ID3rd") c3ads = rsCat("Ads3rd") Response.Write "
        - " & currcat3rdName & " [" & c3ads & "]" Else: Response.Write "
  • " If I mod 3 = 0 then Response.Write "" & vbcrlf Response.Write vbcrlf & "
    " & vbcrlf rsCat.close set rsCat = Nothing Else: Response.Write "
    The Category List is Empty
    " End If %>