请教高手们一个问题,关于“相同内容的单元格 合并单元格”

yinxun 2008-07-31 10:18:22
ASP程序如下:

Response.write("<table border=1 width='100%' cellspacing=1 align=left cellpadding=3 bordercolor=#ad8c42 style=BORDER-COLLAPSE: collapse;><tr><td align=center width='30%'><b>发单时间</b></td><td align=center width='30%'><b>发单人工号</b></td><td align=center width='40%'><b>发单数字</b></td></tr>")

while (not rs.eof) and (not page_count = rs.pagesize)

dim X_gh,X_zh,x_sj,yinx


X_gh = rs("username")
X_zh = rs("yinxun")
X_sj = rs("royo")

%>

<a id="msg<%=rs("rikki")%>">

<tr class="title2" align="center">


<td >
<% response.write X_sj %>
</td>

<td>
<% response.write X_gh %>
</td>
<td>
<% response.write X_zh %>
</td>
</tr>

<%
page_count = page_count + 1
rs.movenext
wend
%>
</table>
<%
call pages()

rs.close
set rs=nothing
end function


这是一个绘制表格的代码,之前的SQL语句是这样的
sql = "Select max(id) as rikki,format(usertime,'yyyy-mm-dd') as royo,username,count(username) as yinxun from [topic] where replycode <> '1' and isnull(tousu) and ((zu2 like '%"&key&"%') and (usertime >= #"&another&" 00:00:00# and usertime <= #"&shijian&" 23:59:59#)) group by format(usertime,'yyyy-mm-dd'),username order by format(usertime,'yyyy-mm-dd')"




用SQL语句执行后,得到这样的结果(ACCESS)


ID(RIKKI) USERTIME(ROYO) USERNAME YINXUN
省略 2008-1-1 100 1
省略 2008-1-1 200 1
省略 2008-1-1 300 1
省略 2008-1-2 100 1
省略 2008-1-3 100 1
省略 2008-1-4 100 1
省略 2008-1-5 100 1

意思就是 2008-1-1 100号员工发了一个帖子,200号发了1个,300号发了1个……

我的ASP就是想统计每天、每个员工的发单量
目前,最上面给出的ASP代码已经完成了统计工作,得到如下报表

发单时间 发单人工号 发单数字
2008-1-1 100 1
2008-1-1 200 1
2008-1-1 300 1
2008-1-2 100 1
2008-1-3 100 1
2008-1-4 100 1
2008-1-5 100 1



但是,我想要把发单时间一致的合并单元格,也就是这样

发单时间 发单人工号 发单数字
100 1
2008-1-1 200 1
300 1
2008-1-2 100 1
2008-1-3 100 1
2008-1-4 100 1
2008-1-5 100 1


请问语句应该怎么写?求教
...全文
55 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jacklinchen 2008-07-31
  • 打赏
  • 举报
回复
用个变量比较判断,如下面红色部分

Response.write(" <table border=1 width='100%' cellspacing=1 align=left cellpadding=3 bordercolor=#ad8c42 style=BORDER-COLLAPSE: collapse;> <tr> <td align=center width='30%'> <b>发单时间 </b> </td> <td align=center width='30%'> <b>发单人工号 </b> </td> <td align=center width='40%'> <b>发单数字 </b> </td> </tr>")

dim X_sj_o
X_sj_o=""

while (not rs.eof) and (not page_count = rs.pagesize)

dim X_gh,X_zh,x_sj,yinx


X_gh = rs("username")
X_zh = rs("yinxun")
X_sj = rs("royo")

%>

<a id="msg <%=rs("rikki")%>">

<tr class="title2" align="center">


<td >
<%
if trim(X_sj_o)<>trim(X_sj) then
response.write X_sj
else
response.write " "
end if

%>
</td>

<td>
<% response.write X_gh %>
</td>
<td>
<% response.write X_zh %>
</td>
</tr>

<%
page_count = page_count + 1
X_sj_o=X_sj
rs.movenext
wend
%>
</table>
<%
call pages()

rs.close
set rs=nothing
end function

28,390

社区成员

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

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