asp 不重复,在次高分处理

来源:百度知道 编辑:UC知道 时间:2024/06/05 14:45:23
<%Set rs=Server.CreateObject("ADODB.Recordset")
sql="select top 9178 a.id,a.mc,a.js,a.tui,a.vip,a.logo,a.dz,a.tel,a.qq from qy_info as a inner join qy_chanpin as b on a.id=b.qy_id where b.lbid="&s.shuzi("lbid")&" and b.xlbid="&s.shuzi("xlbid")&" and a.zt=1 order by a.vip desc,a.ding desc,a.id desc"
rs.open sql,conn,3,1
page1("10")
i=1
do while not rs.eof and i<=rs.pagesize
%> 读取qy_chanpin 字段qy_id 不重复怎么写

帮忙修改,直接粘代码,处理成功加送30分

sql="select distinct qy_id , * from (select top 9178 a.id,a.mc,a.js,a.tui,a.vip,a.logo,a.dz,a.tel,a.qq from qy_info as a inner join qy_chanpin as b on a.id=b.qy_id where b.lbid="&s.shuzi("lbid")&" and b.xlbid="&s.shuzi("xlbid")&" and a.zt=1 order by a.vip desc,a.ding desc,a.id desc)"

distinct 就可以了
select distinct qy_chanpin from ...这样就可以了