ACCESS表指定日期内查询每日汇总?(50)

A

aa20000

Unregistered / Unconfirmed
GUEST, unregistred user!
ACCESS表一字段有:日期/入货数量/出货数量等字段,现希望能按任意指定时间内求查询每日的进货和出货的汇总 和结余请问怎么写出这串代码?[?]
 
SQL的代码,大概是这样,希望对你有帮助,查询每日的进货和出货的汇总 和结余select sum(入货数量) as sr, sum(出货数量) as sc, (sr - sc) as 结余指定时间 where (日期 > 开始日期) and (日期 < 结束日期)
 
日期的格式为 #2010-4-9 11::12::00#我记的是双:这个要注意
 
var d1:string; d2:string;begin d1:=copy(da1.Text,0,pos(':',da1.Text))+':'+copy(da1.Text,pos(':',da1.Text)+1,2)+':'+copy(da1.Text,pos(':',da1.Text)+3,3); d2:=copy(da2.Text,0,pos(':',da2.Text))+':'+copy(da2.Text,pos(':',da2.Text)+1,2)+':'+copy(da2.Text,pos(':',da2.Text)+3,3); 就可以得出 2010-4-9 11::12::00这种格式了,da1,da2为要查的日期段,SQL语句:sql.add('select * from 表 where Ddate>=#'+d1+'# and Ddate<=#'+d2+'#');end;
 

Similar threads

S
回复
0
查看
962
SUNSTONE的Delphi笔记
S
S
回复
0
查看
784
SUNSTONE的Delphi笔记
S
S
回复
0
查看
763
SUNSTONE的Delphi笔记
S
S
回复
0
查看
701
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
顶部