Asp+Access数据库分段统计示例

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../../inc/conn_hr.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Asp+Access数据库分段统计示例</title>
</head>

<body>
<%
sql="select ages, count(*) as num from(select iif(age>=10 and age<=20,'10-20',iif(age>20 and age<=30,'20-30','30+')) as ages from emp) group by ages "
rs.open sql,conn,1,1
while not rs.eof
 response.Write(rs("ages") & ":" & rs("num") & "<br>")
 rs.movenext
wend
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>

posted @ 2008-08-28 19:21  网事  阅读(265)  评论(0编辑  收藏  举报