table
id   name   status
1    客户1  成交客户
2    客户2  成交客户
3    客户3  成交客户
4    客户4  成交客户
5    客户5  订金客户
6    客户6  订金客户
7    客户7  订金客户
8    客户8  订金客户查询结果成交数量    订金数量
5             5是怎么样把结果集放到一起的?

解决方案 »

  1.   

    select (select count(*) from table where status='成交客户') as 成交数量,(select count(*) from table where status='订金客户') as 订金数量
      

  2.   

    select (select count(*)from tb where status='成交客户') as 成交数量,
    (select count(*) from tb where status='定金客户') as 定金数量
    from tb
      

  3.   

    status应该存标志位  存汉字太浪费空间
      

  4.   

    select sum(if(status='订金客户',1,0)),sum(if(status=''成交客户',1,0)) from tt