demo程序开发总结
DateID:日期/时间 格式:2009-9-1
OutcomeMoney:货币 格式:¥124.90
1。datediff("m","2008-6-8",datevalue(now()))中一定要有引号
2。本月最高支出:select DateID,OutcomeMoney from All_Outcome where OutcomeMoney in (select max(OutcomeMoney) from All_Outcome where Datediff('m',DateID,datevalue(now()))=0) and Datediff('m',DateID,datevalue(now()))=0
3。本月总支出:select sum(OutcomeMoney) from All_Outcome where Datediff('m',DateID,datevalue(now()))=0
4。本月所有列表:select ID,DateID,OutcomeMoney,OutcomeContent,Tips from All_Outcome where Datediff('m',DateID,cdate('"&did&"'))=0 order by DateID desc
5。列表年月份(要格式化):select * from (select distinct cdate(year(DateID)&""-""&month(DateID)) as ddd from All_Outcome) as tt order by tt.ddd desc
6。某月共支出:select sum(OutcomeMoney) from All_Outcome where DateDiff('d',cdate(year(DateID)&""-""&month(DateID)),'"&thisYM&"')=0
7。年月列表(步骤):
①选出最小年份:select min(year(DateID)) from All_outCome
②算出最小年份与当年的差距:select datediff('Y','"&m&"','"&Year(Now())&"')
③循环②算出的差距
④For j = 1 To 12
⑤得出本月的支出:sql="select sum(OutcomeMoney) from All_Outcome where DateDiff('Y',year(DateID),year(now()))="&i&" and month(DateID)="&j
8。某某年:<%=Year(Now())-i%>年
总结:难点5列表年月份与难点7循环思路。
- 没有相关文章
- 没有评论