| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:相同字段怎么只显示一条?
只看楼主 加入收藏
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
 问题点数:0 回复次数:4 
相同字段怎么只显示一条?
相同字段怎么只显示一条?
搜索更多相关主题的帖子: 字段 
2008-03-21 10:34
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
如果是所有字段完全相同的用distinct
如果只是部分字段相同,但是想把所有字段都显示用group by
2008-03-21 10:42
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
<table align="center" cellpadding="3" cellspacing="0" width="99%" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee">
  <div align="center">招聘公司</div></td>
<td bgcolor="#eeeeee">
  <div align="center">进入查看</div></td>
<td bgcolor="#eeeeee">
  <div align="center">发布时间</div></td>
</tr>
<%   
set rszp=server.CreateObject("adodb.recordset")
   rszp.open "select top 8 * from zp where sc=1 order by tdate desc",conn1,1,1
if not rszp.eof then
i=0
do while (not rszp.eof) and (i < 8)
i=i+1
%>
<tr>
<td bgcolor="#FFFFFF">
  <div align="center">
  <%if rszp("gstitle")="" then%>
  <%=mid(rszp("JaAdmin"),1,5)%>
  <%else%>
  <%=mid(rszp("gstitle"),1,5)%>
  <%end if%>
  </div></td>
<td bgcolor="#FFFFFF">
  <div align="center"><a href=gszps.asp?id=<%=rszp("JaAdmin")%>>查看</a></div></td>
<td bgcolor="#FFFFFF">
  <div align="center"><%=rszp("tdate")%></div></td>
</tr>
<tr><td height="1" background="images/line.jpg" colspan="3"></td></tr>
<%
rszp.movenext
loop
else
response.write "<tr><td bgcolor=FFFFFF colspan=3>"
response.write "<div align=center>暂无消息</div></td></tr> "
end if
rszp.close
%>    
<% if session("userweb")="公司注册" then%>
<% response.write"<tr><td colspan=3 bgcolor=#FFFFFF>" %>
<%response.write "<div align=right><a href='118user/boke/zp.asp'><font color=#FF0000>我要招聘</font></a>&nbsp;&nbsp;</DIV>"%>
<%response.write"</td></tr>"%>
<%else%>
<% response.write"<tr><td colspan=3 bgcolor=#FFFFFF>" %>
<%response.write "<div align=right><a href='118user/boke/index.asp'><font color=#FF0000>我要招聘</font></a>&nbsp;&nbsp;</DIV>"%>
<%response.write"</td></tr>"%>
<%end if%></table>
我试过distinct 无法运行
select top 8 * from (select distinct 字段 from zp where sc=1 order by tdate desc) 也不行
2008-03-21 10:46
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
rszp.open "select gstitle,tdate from (select distinct JaAdmin from zp where sc=1)",conn1,1,1
rszp.open "select * from (select distinct JaAdmin from zp where sc=1)",conn1,1,1
第二的一条实现了功能 但是gstitle,tdate 的值无法提取
第一条不知道那里错了
2008-03-21 10:57
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
没太看懂楼主的意思 acc数据库,还是mssql,有没有自动编号或identity列
2008-03-21 15:16
快速回复:相同字段怎么只显示一条?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013975 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved