| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 391 人关注过本帖
标题:[求助] 统计信息不准确.急!
只看楼主 加入收藏
lcd2105
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2006-8-22
收藏
 问题点数:0 回复次数:0 
[求助] 统计信息不准确.急!


  烦请帮看一下以下代码,为何在统计中按日期段如果是从第一天到最后一天,统计出来的数据是准确的;而某一天或者某个时间段,统计出来的数据不准确?
我数据库中的时间格式的2006-8-8 10:11:12 。现用了这句代码:year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")) 将时间格式改为2006-8-8 , 是否正确?
请帮指点,为感!

<body>
<table border="1" width="649" id="table1" height="280">
<tr>
<td width="123" align="center" colspan="2" height="13"><font size="2">单位</font></td>
<td width="50" align="center" height="13"><font size="2">A类信息</font></td>
<td width="51" align="center" height="13"><font size="2">B类信息</font></td>
<td width="43" align="center" height="13"><font size="2">总篇数</font></td>
<td width="55" align="center" height="13"><font size="2">总分</font></td>
</tr>
<% set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from news where xxtype='A' and author='一部'"
rs.Open sqlstr,connstr,1,3
if cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))>=cdate(dateb1) and cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))<=cdate(dateb2) then
yba=RS.RECORDCOUNT
ybsa=yba*1
end if
RS.CLOSE

sqlstr="select * from news where xxtype='B' and author='一部'"
rs.Open sqlstr,connstr,1,3
if cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))>=cdate(dateb1) and cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))<=cdate(dateb2) then
ybb=RS.RECORDCOUNT
ybsb=ybb*3
end if
RS.CLOSE

if yba ="" then yba ="0"
if ybb ="" then ybb ="0"
%>

<tr>
<td width="41" valign="middle" align="center" rowspan="5" height="96"><font size="2">一队</font></td>
<td width="77" valign="middle" align="center" height="21"><font size="2">一部</font></td>
<td width="50" valign="middle" align="center" height="21"><font size="2"><%=yba%></font></td>
<td width="51" valign="middle" align="center" height="21"><font size="2"><%=ybb%> </font></td>
<td width="43" valign="middle" align="center" height="21"><font size="2"><%=yba+ybb%></font></td>
<td width="55" valign="middle" align="center" height="21"><font size="2"><%=ybsa+ybsb%></font></td>
</tr>
</body>

搜索更多相关主题的帖子: 统计 
2006-08-24 14:37
快速回复:[求助] 统计信息不准确.急!
数据加载中...
 
   



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

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