28,391
社区成员
发帖
与我相关
我的任务
分享
sql="select top 4 newsid,title,picname,content from news where typeid=2 and bigclassid="&bigclassid&" and newsid not in (select top 1 newsid,title,picname,content from news where typeid=2 and bigclassid="&bigclassid&" and checkked=1 order by bigclassid desc) and checkked=1 order by bigclassid desc"
或者你改成
sql="select top 4 newsid,title,picname,content from news where typeid=2 and bigclassid="&bigclassid&" and newsid not in (select top 1 newsid from news where typeid=2 and bigclassid="&bigclassid&" and checkked=1 order by bigclassid desc) and checkked=1 order by bigclassid desc"
你这上面SQL语句就有问题,肯定查询不出来
<%
set rsb=server.createobject("adodb.recordset")
sql="select bigclassid from bigclass order by bigclassid desc"
rsb.open sql,conn,1,1
bigclassid=Trim(rsb("bigclassid"))
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="249" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40"> </td>
<%set rs=server.createobject("adodb.recordset")
sql="select top 1 newsid,title,picname,content from news where typeid=2 and bigclassid="&bigclassid&" and checkked=1 order by bigclassid desc"
rs.open sql,conn,1,1
if not (rs.eob and rs.bof) then
NewsID=rs(0)
%>
<td width="209"> <table width="209" height="158" border="0" cellpadding="4" cellspacing="1" bgcolor="#E6E6E6">
<tr>
<td bgcolor="#F0F0F0">
<table width="201" height="150" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"> <a href="uploadfile/ <%=rs("picname")%>" rel="lightbox" title="效果展示."> <img src="uploadfile/ <%=rs("picname")%>" alt="" width="201" height="150" border="0" /> </a> </td>
</tr>
</table> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="12"> </td>
</tr>
<tr>
<td height="23" bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#F6F6F6">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> <img src="img/index_24_1.gif" width="17" height="17"> </td>
<td height="23" class="xg1"> <%=rs("title")%> </td>
</tr>
<tr>
<td> </td>
<td class="xg2"> <%=left(rs("content"),20)%>... </td>
</tr>
</table> </td>
</tr>
</table> </td>
</tr>
</table> </td>
<%
end if
rs.close
set rs=nothing
%>
</tr>
</table> </td>
<%
set rs=server.createobject("adodb.recordset")
sql="select top 4 newsid,title,picname,content from news where typeid=2 and bigclassid="&bigclassid&" and newsid <>"&NewsID&" and checkked=1 order by bigclassid desc"
rs.open sql,conn,1,1
%>
<td width="341" valign="top">
<%
do while not rs.eof
%>
<table width="341" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="76"> <table width="66" height="51" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#E6E6E6">
<tr>
<td bgcolor="#F0F0F0"> <table width="60" height="45" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="60" height="45" bgcolor="#FFFFFF"> <a href="uploadfile/ <%=rs("picname")%>" rel="lightbox" title="效果展示."> <img src="uploadfile/ <%=rs("picname")%>" alt="" width="60" height="45" border="0" /> </a> </td>
</tr>
</table> </td>
</tr>
</table> </td>
<td width="253" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> <img src="img/index_24_1.gif" width="17" height="17"> </td>
<td height="23" class="xg1"> <%=rs("title")%> </td>
</tr>
<tr>
<td> </td>
<td class="xg2"> <%=left(rs("content"),30)%>... </td>
</tr>
</table> </td>
</tr>
</table>
<%
rs.movenext
i=i+1
loop
%>
</td>
<%
rs.close
set rs=nothing
%>
</tr>
</table>
<%
rs1.close
set rs1=nothing
%>