N
nbyyslf
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在在做一个报表,在DBGRID上的标题为20岁以下,21-30,31-40,41-50
坚的为各职称,就是汇总一种职称内,各年龄段的人数有多少!
with query1 do
begin
close;
sql.Clear;
sql.add:=('select sum(case when csny-getdate()<=20 then 1 else o end)');
sql.add:=(' sum(case when csny-GetDate()>=21 and csny-GetDate()<=30 then 1 else 0 end)');
sql.Add:=(' sum(case when csny-GetDate()>=31 and csny-GetDate()<=40 then 1 else 0 end)');
sql.add:=(' sum(case when csny-GetDate()>=41 and csny-GetDate()<=50 then 1 else 0 end)');
sql.add:=(' sum(case when csny-GetDate()>=51 and csny-GetDate()<=60 then 1 else 0 end)');
sql.add:=(' sum(case when csny-getdate()>=61 then 1 else o end) from rs_ryb');
ExecSQL
end;
请问这里哪里不对!第一行就说不对了!
在线等,
坚的为各职称,就是汇总一种职称内,各年龄段的人数有多少!
with query1 do
begin
close;
sql.Clear;
sql.add:=('select sum(case when csny-getdate()<=20 then 1 else o end)');
sql.add:=(' sum(case when csny-GetDate()>=21 and csny-GetDate()<=30 then 1 else 0 end)');
sql.Add:=(' sum(case when csny-GetDate()>=31 and csny-GetDate()<=40 then 1 else 0 end)');
sql.add:=(' sum(case when csny-GetDate()>=41 and csny-GetDate()<=50 then 1 else 0 end)');
sql.add:=(' sum(case when csny-GetDate()>=51 and csny-GetDate()<=60 then 1 else 0 end)');
sql.add:=(' sum(case when csny-getdate()>=61 then 1 else o end) from rs_ryb');
ExecSQL
end;
请问这里哪里不对!第一行就说不对了!
在线等,