select 部门,变动,count(*) from table group by 部门,变动

解决方案 »

  1.   

    按 部门、变动 分组,不行吗?select 部门,变动,count(*)
      from table
    group by 部门,变动
      

  2.   

    select id ,部门,count(select 变动 from table where table.变动=辞职),count(select 变动 from table where table.变动=休假),count(select 变动 from table where table.变动=停职) from table group by 部门
      

  3.   

    select 部门,变动,count(*) from table group by 部门,变动
      

  4.   

    select id ,部门,count(select 变动 from table where table.变动=辞职),count(select 变动 from table where table.变动=休假),count(select 变动 from table where table.变动=停职) from table group by 部门
      

  5.   

    select 部门,count(select 变动 from table where table.变动=辞职) as 辞职,count(select 变动 from table where table.变动=休假) as 休假,count(select 变动 from table where table.变动=停职) as 停职 from table group by 部门
      

  6.   

    我用的数据库为paradox,scu96124678的好像行不通了,出错啊
      

  7.   

    select 部门,count(case when 变动='辞职' then 变动 end) '辞职' ,count(Case when 变动='休假' then 变动 end) '休假',count(case when 变动='停职'then 变动 end) '停职' from table1 group by aDepart
      

  8.   

    好你在paradox中不支持吧,老是报错
    说是Invalid use of keyword token:select 
      

  9.   

    如果是先按部门分开,再显示不同变动情况的数目,应该是
    select 部门,变动,count(*) from table group by 变动,部门scu96124678(绿林侠)的语句会有一点问题,即有的部门可能会没有其中一种变动情况。如果想让每个部门都按三种变动分别显示数目,即没有的那种变动情况数显示为0,则需再建一张变动名称表,两张表进行外连接。
      

  10.   

    paradox中的Tquery支持select子查询吗?为什么老是错