Weeeeeno, a ver si así te queda algo más claro xDDDD
Código PHP:
<%
'Lo primero, Te conectas a la BBDD
'y haces la consulta SQL
'Miramos si hay registros en el resultado
If rs.BOF And rs.EOF Then
'Si no hay registros, no mostramos nada
'Si hay registros, empezamos a pintar la tabla
'y reiniciamos el contador
else
contador = 1
'Creamos un Bucle que pinte la tabla principal,
'siempre y cuando existan más registros que sacar
While Not rs.EOF
%>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100">
<%
'Si hay un registro que mostrar, pintamos la tabla
'interior con el contenido de los RecordSet y el contador
if NOT Rs.EOF
%>
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>ESTO ES LA TABLA 1</td>
</tr>
</table>
<%
'Incrementamos el contador y saltamos a un nuevo registro
contador = contador + 1
Rs.Movenext()
End if
%>
</td>
<td width="100">
<%
'Si hay un registro que mostrar, pintamos la tabla
'interior con el contenido de los RecordSet y el contador
if NOT Rs.EOF
%>
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>ESTO ES LA TABLA 2</td>
</tr>
</table>
<%
'Incrementamos el contador y saltamos a un nuevo registro
contador = contador + 1
Rs.Movenext()
End if
%>
</td>
<td width="100">
<%
'Si hay un registro que mostrar, pintamos la tabla
'interior con el contenido de los RecordSet y el contador
if NOT Rs.EOF
%>
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>ESTO ES LA TABLA 3</td>
</tr>
</table>
<%
'Incrementamos el contador y saltamos a un nuevo registro
contador = contador + 1
Rs.Movenext()
End if
%>
</td>
<td width="100">
<%
'Si hay un registro que mostrar, pintamos la tabla
'interior con el contenido de los RecordSet y el contador
if NOT Rs.EOF
%>
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>ESTO ES LA TABLA 4</td>
</tr>
</table>
<%
'Incrementamos el contador y saltamos a un nuevo registro
contador = contador + 1
Rs.Movenext()
End if
%>
</td>
</tr>
</table>
<%
'Volvemos a la parte superior del Bucle, o
'terminamos el bucle de pintar la Tabla Principal
si ya no quedan más registros que mostrar
Wend
End if
%>
Y ya está ! no hace falta pintar más tablas, ni nada de nada