非常简单问题,重复的记录只显示一条!

Any81 2003-10-10 03:39:50
sqll="select top 10 * from ad_info where hot='1' order by stime desc"

如果我想显示前10条记录,如果title字段重复,只显示一条!
但我要查询所有字段

谢谢,!
...全文
187 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
qgandzly 2004-01-12
  • 打赏
  • 举报
回复
sqll="select distinct top 10 title from ad_info where hot='1' group by title order by stime desc"
tmdfsl 2004-01-12
  • 打赏
  • 举报
回复
select distinct top 10 title from tablename group by title
lovewing82 2004-01-12
  • 打赏
  • 举报
回复
是显示记录么?
记住 rsl.open sql,connstr,1,3后一定要确定数据库里有内容。。。没有内容的话会出错的
或者加上
if not rs.eof and not rs.bof then
......
else
......
end if
yonghengdizhen 2004-01-12
  • 打赏
  • 举报
回复
to xzq686(瞬)
你认为(ad_infoid in(Select distinct ad_infoid From ad_info))
这个条件和 1=1这个条件有差别吗?
xzq686 2004-01-12
  • 打赏
  • 举报
回复
ad_infoid是表中的一个字段比如id
Select * From ad_info
Where (hot='1') and (ad_infoid in(Select distinct ad_infoid From ad_info))
Order by stime desc
xzq686 2004-01-12
  • 打赏
  • 举报
回复
select field1,field2 from table where hot='1' group by field1,field2 having count(*)=1 order by stime desc'
yonghengdizhen 2004-01-12
  • 打赏
  • 举报
回复
select top 10 * from ad_info a where hot='1' and stime=(select max(stime) from ad_info where hot='1' and title=a.title) order by stime desc
yonghengdizhen 2004-01-12
  • 打赏
  • 举报
回复
select top 10 * from ad_info a where hot='1' and stime=(select max(stime) from ad_info where title=a.title) order by stime desc
超级大笨狼 2004-01-12
  • 打赏
  • 举报
回复
<script language=vbs>
'功能:从很多字串中排除相同字串
'输入:很多字串组成的数组:
dim A,B
A=array("字串1","字串2","字串3","字串1","字串2","字串1","字串4")
'输出:
B=F(A)
'显示结果:B=array("字串1","字串2","字串3","字串4")
for each bbb in B
document.write bbb & "<br>"
next

'函数部分
function F(x)'这里x是形参
dim S,D
Set D = CreateObject("Scripting.Dictionary")
for each xxx in x
if not d.Exists(xxx) then D.Add xxx,xxx
next
for each key in D.Keys
S=S & key & " "
next
set D=nothing
F=split(trim(S))
end function
</script>
wggipkhgef 2003-10-10
  • 打赏
  • 举报
回复
rsl.open sqll,connstr,1,3
从你的多次回复中可以看出,这一行是决对没有错的了
错的还是SQL语句
sqll="select distinct top 10 * from ad_info where hot='1' order by stime desc"
应当没错的啊
pepos 2003-10-10
  • 打赏
  • 举报
回复
sqll="select distinct top 10 title from ad_info where hot='1' group by title order by stime desc"
set rsl=server.createobject("adodb.recordset")
rsl.open sqll,connstr,1,3
把这句rsl.open sqll,connstr,1,3后面的1,3改成3,3试试看,或者为rsl.open sqll,connstr,3也可以

Any81 2003-10-10
  • 打赏
  • 举报
回复

sqll="select top 10 * from ad_info where hot='1' order by stime desc"
set rsl=server.createobject("adodb.recordset")
rsl.open sqll,connstr,1,3

这样不报错,但是改一下sqll语句就报错了!
错的行是:rsl.open sqll,connstr,1,3
Any81 2003-10-10
  • 打赏
  • 举报
回复
为什么就是报错
LoneHome 2003-10-10
  • 打赏
  • 举报
回复
sqll="select distinct top 10 title from ad_info where hot='1' group by title order by stime desc"
LoneHome 2003-10-10
  • 打赏
  • 举报
回复
sqll="select distinct * from ad_info where hot='1' group by title order by stime desc"
srj911 2003-10-10
  • 打赏
  • 举报
回复
sqll="select distinct * from ad_info where hot='1' order by stime desc"
Any81 2003-10-10
  • 打赏
  • 举报
回复
为什么回报错!
angelheavens 2003-10-10
  • 打赏
  • 举报
回复
sqll="select distinct top 10 * from ad_info where hot='1' order by stime desc"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧