M
maomao888
Unregistered / Unconfirmed
GUEST, unregistred user!
dlnew-2我还可以问你一个问题吗:
还是关于查询的问题:
我在QUERY中写了一段SQL,如下:
select b.cbzxbh,b.cbzxmc,b.ccpnjh/12,b.bcpnjh/12,sum(a.drcl),0,sum(a.drcl)/(b.ccpnjh/12),0 from db2admin.t_scrbmx a,erptest.t_acpczjh b
where b.cbzxbh=a.jgbh and a.rq>:d1 and a.rq<:d2
group by b.cbzxbh,b.cbzxmc,b.ccpnjh,b.bcpnjh
union all
select b.cbzxbh,b.cbzxmc,b.ccpnjh/12,b.bcpnjh/12,0,sum(c.drcl),0,sum(c.drcl)/(b.bcpnjh/12) from db2admin.t_scrbmx c,erptest.t_acpczjh b
where b.cbzxbh=c.jgbh and c.rq>:d1 and c.rq<:d2 and c.wlbh like '%-%'
group by b.cbzxbh,b.cbzxmc,b.ccpnjh,b.bcpnjh
其实:D1,D2,是两个参数,我通过以下在一个BUTTON中,给它传的参数:如下:
form1.Query1.ParamByName('d1').asdate:=strtodate(form1.edit3.text);
form1.query1.ParamByName('d2').asdate:=strtodate(form1.edit4.text);
if form1.query1.prepared=false then
form1.query1.prepare;
form1.query1.open;
end;
此外,我还想分别通过BHZXBH,JHNF,JGBH,来分别进行(通过传参数)查询,这两个字段,分
别从我上面SQL写到的erptest.t_acpczjh 提取。
关于这三个分别查询的参数如何调用?
还是关于查询的问题:
我在QUERY中写了一段SQL,如下:
select b.cbzxbh,b.cbzxmc,b.ccpnjh/12,b.bcpnjh/12,sum(a.drcl),0,sum(a.drcl)/(b.ccpnjh/12),0 from db2admin.t_scrbmx a,erptest.t_acpczjh b
where b.cbzxbh=a.jgbh and a.rq>:d1 and a.rq<:d2
group by b.cbzxbh,b.cbzxmc,b.ccpnjh,b.bcpnjh
union all
select b.cbzxbh,b.cbzxmc,b.ccpnjh/12,b.bcpnjh/12,0,sum(c.drcl),0,sum(c.drcl)/(b.bcpnjh/12) from db2admin.t_scrbmx c,erptest.t_acpczjh b
where b.cbzxbh=c.jgbh and c.rq>:d1 and c.rq<:d2 and c.wlbh like '%-%'
group by b.cbzxbh,b.cbzxmc,b.ccpnjh,b.bcpnjh
其实:D1,D2,是两个参数,我通过以下在一个BUTTON中,给它传的参数:如下:
form1.Query1.ParamByName('d1').asdate:=strtodate(form1.edit3.text);
form1.query1.ParamByName('d2').asdate:=strtodate(form1.edit4.text);
if form1.query1.prepared=false then
form1.query1.prepare;
form1.query1.open;
end;
此外,我还想分别通过BHZXBH,JHNF,JGBH,来分别进行(通过传参数)查询,这两个字段,分
别从我上面SQL写到的erptest.t_acpczjh 提取。
关于这三个分别查询的参数如何调用?