Okay here is the work around. And sorry, I left out the </td> last time, that's why it looks a bit funky.
SQL = "SELECT DISTINCT TC.topcategory,MC.middlecategory "&_
"FROM tbtopcategory TC,tbmiddlecategory MC,tbconnectcategory CC "&_
"WHERE TC.topcategoryID = CC.topcategorylink "&_
"AND MC.tbmiddlecategoryID = CC.middlecategorylink " &_
"GROUP BY TC.topcategory "
RS.Open SQL,Conn
Cols = 3
Response.Write("<table width='570' border='1'>")
If Not RS.EOF then
Do Until RS.EOF
Response.Write("<tr>")
For i = 1 To Cols
If RS.EOF then
Response.Write("<td width='190'>xx")
Else
Response.Write("<td width='190'>")
TopCat = RS("topcategory")
If LastTopCat <> TopCat or Then
Response.Write(RS("topcategory") & "<br>")
Response.Write("-----------------------------<br>")
LastTopCat = TopCat
Response.Write(RS("middlecategory"))
End If
Response.Write("</td>")
RS.MoveNext
End If
Next
Response.Write("</tr>")
loop
End If
Response.Write("</table>")
Reputation Points: 43
Solved Threads: 68
Veteran Poster
Offline 1,080 posts
since Sep 2007