就是说把A表里‘男’‘女’性别人数分别统计出来,然后在把这两个人数分别写到B表里‘男性人数’‘女性人数’这两个字段里,怎么写?

解决方案 »

  1.   

    你这问题问题太没有边际了,你AB表的结构都没有。
    总之就是类似
    select count(*) from a where 性别='男' 这类的写法
      

  2.   

    select men=(select count(*) from  sourcetable where 性别='男' )
           women=(select count(*) from  sourcetable where 性别='女')
    from yourtable
    取数据
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    insert into targetable (男,女) values (rs(0),rs(1))  
    写数据
      

  3.   

    select Type,Count(*)as count 
    into #T
    from Table Group by Type
    其中Type代表性別 ,這樣就得到男女人數各多少Update Table set ManCount=b.count from #T as b where b.Type='男'
    Update Table set WuManCount=b.count from #T as b where b.Type='女'Drop Table #T
      

  4.   

    sql server:insert into b(男性人数,女性人数)
    select sum(case when sex='男' then 1 else 0 end) as 男性人数,
    sum(case when sex='女' then 1 else 0 end) as 女性人数
    from a
    access:
    insert into b(男性人数,女性人数)
    select sum(iif(sex='男',1,0)) as 男性人数,
    sum(iif(sex='女',1,0)) as 女性人数
    from a
      

  5.   

    select   from  into tablename
      

  6.   

    select * from A where 姓别='男'
    b.1:=a.reocrdcourt;
    select * from A where 姓别='女'
    b.2:=a.reocrdcourt;
      

  7.   

    ....
    select count(*) as count from a where 性别='男'
    ....
    a1:=strtoint(adoquery.fieldbyname('count').asstring)
    .....
    select count(*) as count from a where 性别='女'
    ....
    b1:=strtoint(adoquery.fieldbyname('count').asstring)
    insert into table(...) values(a1,b1)