1.写一个存储过程
2.自己 
   while not eof do
   {
      doit;
      next;
    }    

解决方案 »

  1.   

    select Count(*) 总人数,
    (select Count(*) from TableName where Age<5 and Sex='男') 人数一
    (select Count(*) from TableName where Age<10 and Sex='男') 人数一
    from TableName大概是这样,自己把条件整理一下即可。
    —————————————————————————————————
    MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
                 毁誉由人,望天上云卷云舒,聚散任风。';
    if Not Assigned(I) then
      I := TI.Create(Nil);
    I.Maxim := MaximStr;
    —————————————————————————————————
           
      

  2.   

    select count(出生日期) as aa,(select count(出生日期) from 表名 where 年龄>=0 and 年龄<5 and 性别='男') as bb,
    (select count(出生日期) from 表名 where 年龄>=0 and 年龄<5 and 在职) as cc from 表名 where 年龄>=0 and 年龄<5
    注:
    其中表名都是指的同一个表的名称,别名aa 求的是 0-5岁的人数,bb求的是0-5岁的男性人数,cc求的是0-5岁的在职人数....依此类推,日期字段的内容要经过运算才得到年龄,在此就不多说了