alter table tab_name add col_name int(10) auto_increment;

解决方案 »

  1.   

    试试下面语句吧!
    create table a(id integer ,qty dec default 0.00 null)
    insert into a(id,qty)values(1,10)
    insert into a(id,qty)values(3,20)
    insert into a(id,qty)values(2,30)
    insert into a(id,qty)values(4,15)
    select aa.qty,count(*) from a aa,a bb where  aa.qty<=bb.qty
    group by aa.qty
    select aa.qty,count(*) from a aa,a bb where  aa.qty>=bb.qty
    group by aa.qty