vb 从 access 中选一列最大值,为什么结果不对?平均数对。
Set Rs = cnnMDB.Execute("select max(金额) as AAAA from 支出" & " where datediff('d',[日期],'" & Month(Date) & "-1" & "')<=0 and datediff('d',[日期],'" & Format$(Date, "General Date") & "')>=0")msgbox Rs.Fields("AAAA")
为什么结果不是当月的最大值?????
--------------------编程问答-------------------- Set Rs = cnnMDB.Execute("select max(A.金额) as AAAA from (SELECT * FROM 支出 where Month([日期])=Month(NOW)) AS A"
--------------------编程问答-------------------- 是查询本月当期记录吗?
Set Rs = cnnMDB.Execute("select max(金额) as AAAA from 支出" & " where 日期 >= #" & Format(Date, "yyyy-mm") & "-01# And 日期<#" & Format(Date+1, "yyyy-mm-dd") & "#") --------------------编程问答--------------------
Set Rs = cnnMDB.Execute("select max(金额) as je from 支出 where Month([日期])=" & Month(NOW)
补充:VB , 数据库(包含打印,安装,报表)