各位商手请教下,,在一表有一个字段,,,该字段有会员和湖南移动客户两种值,,,怎么写sql统计它的值,,并显示为会员量多少,移动客户是多少,,,,
我写了条sql
select count(*) as 新增会员数量 from td_shop_shopper_info where shopper_type='会员' or shopper_type='湖南移动客户' group by shopper_type
查询出来是这样的:新增会员量
                     31
                     34

解决方案 »

  1.   

    select shopper_type,count(*) as 新增会员数量 from td_shop_shopper_info where shopper_type='会员' or shopper_type='湖南移动客户' group by shopper_type
      

  2.   

    用五笔啊字段只有两种值的话,就不用加where过滤了吧select shopper_type, count(1) from td_shop_shopper_info group by shopper_type
      

  3.   

    select count(*) as 新增会员数量 from td_shop_shopper_info group by  shopper_type
      

  4.   

    select shopper_type,count(*) as 新增会员数量 from td_shop_shopper_info  group by shopper_type
      

  5.   


    select shopper_type,count(*) as 新增会员数量 from td_shop_shopper_info  group by shopper_type
      

  6.   

    表结构就查它一个字段
     shopper_type
        会员
        移动客户
        会员
        移动客户我是想分别统计它数量
    并按行显示出来
    会员:31
    移动客户:34
      

  7.   

    with td_shop_shopper_info as (
    select '会员' shopper_type from dual
    union all
    select '会员' from dual
    union all
    select '移动客户'  from dual
    union all
    select '移动客户'  from dual
    union all
    select '移动客户'  from dual
    )
    select shopper_type 会员类型,count(*) 新增会员数量 from td_shop_shopper_info  group by shopper_type;
    ========结果=============会员类型   新增会员数量
    ----------------------
    会员             2
    移动客户         3