ASP+ACCESS
数据库中的记录是这样的:
时间 标题
2012-8-5 张三
2012-8-5 李四
2012-8-5 王五
2012-8-6 王麻子
2012-8-6 张小泉
2012-8-7 唐僧
2012-8-10 悟空
现在希望有一代码码,把以上信息按时间进行规纳
结果如下:
2012-8-5 :张三,李四,王五
2012-8-6 :王麻子,张小泉
2012-8-7 :唐僧
2012-8-19 :悟空
有没有高人给一段代码?有效代码全分!
------解决方案--------------------
access合并记录没弄过,用asp处理下就好了
- VBScript code
rs.open "select [时间], [标题] from 表 order by [时间]",conn,1,3
tmp="":nowtmp=""
while not rs.eof
tmp=year(rs(0))&"-"&month(rs(0))&"-"&day(rs(0))
if nowtmp<>tmp then
if nowtmp<>"" then response.write "<br/>"
response.write rs(0)&" : "&rs(1)
nowtmp=tmp
else
response.write ","&rs(1)
end if
rs.movenext
wend
rs.close