codice:
'Non ho avuto il tempo di testarlo..provaa un pò così...

<%
lung_tab="" 
alt_tab="" 
alt="" 
lun="" 
Contatore=0

sql_count="SELECT count(*) as num FROM tabella where campo='"&valore&"'" 
set rs_count = Server.CreateObject("ADODB.Recordset") 
rs_count.open sql_count, Conn 

if rs_count("num_appl")=1 then 
	lung_tab="150" 
	alt_tab="80" 
elseif rs_count("num")<4 then 
	lung_tab="150" 
	alt_tab="100" 
else 
	lung_tab="300" 
	alt_tab="200" 
end if 
%> 
Contatore=4
<table bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" border="1" align="center" cellspacing="0" width="<%=lung_tab%>" height="<%=alt_tab%>"> 
<% 
	do while rs.eof = false 
		if Contatore=4 then
			Contatore=1
		%>
			<tr valign="middle" align="center"> 
		<%end if>

		sql="SELECT * FROM tabella1 where campo1='"& rs("valorecampo1") & "'" 
		set myrset = Server.CreateObject("ADODB.Recordset") 
		myrset.open sql, Conn_oracle 

		if rs_count("num")=1 or rs_count("num")<4 then 
			lun="10" 
			alt="50" 
			'lungh_tab="50" 
			'alt_tab="100" 
		else 
			lun="50%" 
			alt="50%" 
		end if 
		%>
		<td nowrap align="center" valign="middle" width="<%=lung%>" height="<%=alt%>" border="1"> 		
			<a href="../prova/prova.asp?prova=<%=myrset("valorecampo1")%>"><%=myrset("valorecampo1")%> 
			</a> 
		</td> 
		<%
		Contatore=Contatore+1
		if contatore=4 then%>
		</tr>
		<%end if
		myrset.Close
		
<%
	rs.movenext 
loop
rs.close
set rs=nothing
set myrset=nothing
if contatore<4 then
	%>
	</tr>
	<%
end if
%>
</table>