ASP调用数据库新闻,求高手帮忙。。。

来源:百度知道 编辑:UC知道 时间:2024/05/28 08:53:20
新闻表 xinwen company新闻定义名 day新闻发表日期
表class1 是大类 如 id=1 国内新闻 id=2国际新闻
表class2是分类 id=1 国内股市 id=2 国内军事 id=3 国内娱乐
id=4 国际娱乐 id5=国际资讯 id=6 国际军事

class1 id=1包括 class2的id=1 id=2 id=3

class1 id=2 包括 class2的 id=4 id=5 id=6

我想只调用class1 id=1内包括的 class2的id=1 id=2 id=3 的 新闻。。。 显示3个 class2 的内容 新闻定义名 日期

请高手帮忙啊,小弟万分感激。。。在线等解决啊。。
我把代码写上。。。
<table>
<%dim ns
set rsfox=server.createobject("adodb.recordset")
sqlfox="select top 9 * from xinwen where yz=1 order by fbsj desc"
rsfox.open sqlfox,conn,1,1
if rsfox.eof then
response.write "正在添加中!"
else
do while not rsfox.eof
%>

<%dim rsfoxf,sqlfoxf
set rsfoxf=server.createobject("adodb.recordset")
sqlfoxf="select class2 from class2 where id="&rsfox("class2")&""
rsfoxf.open sqlfoxf,conn,1,1

class2中应该有一个字段是和class1相对应的吧

xinwen中应该有一个字段和class2对应吧

select top 3 company,day from xinwen where [class2id] in (select id from class2 where class1id=1) order by day desc

class2中,其实是应该有class1的id内容的吧

虽然我不是很懂,但是我觉得你的数据库表设计有问题