select count(*) from tbname where instr(部门,'A')>0;

解决方案 »

  1.   

    你要对什么group by,感觉你这种结构很难实现groupby
      

  2.   

    建议用两个表来做这事,table1:部门
    A
    B
    C
    .
    .
    .table2:
    报告号  部门s
    0001    A,B
    0002    B,C
    0003    A,B,Cselect table1.部门, count(*) from table1, table2 
        where instr(table2.部门s, table1.部门)>0
        group by table1.部门运行结果:部门         COUNT(*)
    ---------- ----------
    A                   2
    B                   3
    C                   2
      

  3.   

    我原来的表结构为:
    report表:
    reportID(主键)  责任部门  其他属性
    00001           A,B为了方便统计改成:
    report表:
    reportID(主键)  其他属性
    00001
    中间表:
    reportID   责任部门
    00001        A
    00001        B大家觉得加个中间表与使用存储结构哪个更好一点