select @x:=ifnull(@x,0)+1 as rownum,t.* from xx_product_sale t;



或者:



set @index=0;       

select @index:=(@index+1) as idx, id from t_sys_menu;



idxid

110

217

325

426

527

650

754

855

961

1069

1172

1274

1393

1496

15101

16112

17113

18114

19115

2011

2112

2252

23100

24109

2518

2623

2764

2899

2965

3086

3139

3240

3346

3447

3549

3677

3751

3856

3959

4071

41104

4257

4358

4460

4588

4662

4763

4866

4967

5068

5178

5279

5380

5470

5587

5689

5773

5875

5976

6081

6182

6283

6384

6485

6594

6695

6797

6898

69102

70103