asp+access按年,按月统计,求助。 - Web 开发 / ASP
表d_fy
字段:d_id(自动编号), d_je(货币型),d_sxrq(日期型)
表数据如下:
d_id d_je d_sxrq
1 20 2009-5-1
2 30 2009-5-6
3 10 2009-6-5
4 15 2009-6-25
5 5 2009-8-8
6 50 2009-9-9
7 20 2010-5-1
8 40 2010-5-6
9 15 2010-6-5
10 25 2010-6-25
11 55 2010-8-8
12 65 2010-9-9
想按年按月来统计:
如果选择2009年得到
月份 1 2 3 4 5 6 7 8 9 10 11 12
金额 0 0 0 0 50 25 0 5 50 0 0 0
如果选择2010年得到:
月份 1 2 3 4 5 6 7 8 9 10 11 12
金额 0 0 0 0 60 40 0 55 65 0 0 0
请问这样的分组查询应该怎么写,前台怎么运用,谢谢。
select sum(case month(d_sxrq) when 1 then d_je else 0 end) as [1月],如上,,,,, from d_fy where year(d_sxrq) = 2009
应该可以从数据库那着手,查出来的就是某年某月的统计量
select count(month(d_sxrq)) from order by year(d_sxrq)....大致思路是这样,没测试过
谢谢两位回复,
aspwebchh,我用你给你的测试了一下,取不到数据。
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select sum(case month(d_sxrq) when 1 then d_je else 0 end) as 1y,sum(case month(d_sxrq) when 2 then d_je else 0 end) as 2y,sum(case month(d_sxrq) when 3 then d_je else 0 end) as 3y,sum(case month(d_sxrq) when 4 then d_je else 0 end) as 4y,sum(case month
相关问答:
http://www.zgjhjy.com/Test/PrimaryTest/Index.aspx
就是类似以上的在线测试系统,需要有一个后台的,语言是asp的,数据库是access的,还需要能在后台对信息进行添删改查的。谢谢各位了。。。
程序真的很多,不知 ......
在asp里怎么调用java写的webservice方法,有很多方法
- <message name="RtPnrIn">
<part name="bstrPnrNO" type="s:string" />
<part name ......
Microsoft JET Database Engine '80040e07'
标准表达式中数据类型不匹配。
\wwwroot\update.asp, line 20
--------------------------------------------------------------------------------
Ho ......
1.asp.net做的一个答题页面,如何实时限时后自动提交,请大家给点思路
限时的时间信息存放在数据库中
2.如果答题时间设置的较长,如何方式session超时后页面无效
谢谢
用js方法来控制
回复内容太短了。。
js ......
asp 翻页怎么实现?
分页可使用分页控件如aspnetpager
没找到此控件!!!!!
第三方组件 需要在网上去下载 http://www.webdiyer.com/Controls/AspNetPager/Downloads
不用控件 怎么做啊!
hehe
不 ......