select count(distinct bid) from emplee
select bid,count(1) from emplee group by bid

解决方案 »

  1.   


    select count(*) from (select e.bid from tabname group by e.bid)select e.bid,count(*) from tabname group by e.bid我这个也可以,只是好像没上面那个简洁
      

  2.   

    经理个数:
    select count(*) from (select distinct u.bid from emplee u)
    经理所管员工的个数:
    select u.bid,count(id) from emplee u group by u.bid扩充:
    select u.bid,count(id) from borrow u group by u.bid having count(1)>(= <)number
      

  3.   

    我怎么觉得select count(distinct bid) from emplee是查询了所有的员工和经理的数量呢?
    我的select count(*) from emplee where bid like '经理%';
      

  4.   

    manager number:
    select count(*) from (select distinct bid from emplee where bid like '经理%');
      

  5.   

    如果BID可能重复的话就不能用楼上的语句啊
    还是其他的语句差不多啊