select a.field1 f1,count(a.field1) f2 from table1 a where ...
order by count(a.field1)

解决方案 »

  1.   

    你上面的语句不能这样用,需在后面加上Group by a.field1才能够
    得到field1的内容和满足条件的具体数目.再加上order by a.field1
    就OK了!!
      

  2.   

    上面有一点失误,order by f2 就行了.
      

  3.   

    select a.field1 f1,count(a.field1) f2 from table1 a where ...
    group by a.field1
    order by count(a.field1)   
      

  4.   

    select a.field1 f1,count(a.field1) f2 from table1 a where ...
    group by a.field1
    order by f2