我可不可以对select出来的结果自动按1 2 3这样编号注:不是用自增长ID比如select * from a where id>10这样的

解决方案 »

  1.   

    示例
    select a.id,count(*) from tt a left join tt b on a.id>=b.id
    group by a.id
      

  2.   

    http://blog.csdn.net/acmain_chm/article/details/4095531
    MySQL中的ROWNUM的实现
    MySQL 几乎模拟了 Oracle,SQL Server等商业数据库的大部分功能,函数。但很可惜,到目前的版本(5.1.33)为止,仍没有实现ROWNUM这个功能。 下面介绍几种具体的实现方法.建立实验环境如下mysql> create table tbl (    ->  id      int primary key,    ->  col     int    -> );Que...