-
无分组
select @rownum:=@rownum+1 as autoSeq, sid,pid,oprimary,seq from singlechoice,(select @rownum:=0) r order by pid,sid
-
单字段分组
select (@i := case when @tableName=a.tablename then @i + 1 else 1 end ) as rowIndex, a.*,(@tableName:=a.tablename) from tablestyle a,(select @i:=0,@tableName:='') as t group by tablename,fieldname order by tablename,(@i := case when @tableName=a.tablename then @i + 1 else 1 end )
-
多字段分组
select (@i := case when @tableName=concat(a.dbname,a.tablename) then @i + 1 else 1 end ) as rowIndex, a.*,(@tableName:=concat(a.dbname,a.tablename)) as temp from tablestyle a,(select @i:=0,@tableName:='') as t group by dbname,tablename,fieldname order by dbname,tablename,(@i := case when @tableName=concat(a.dbname,a.tablename) then @i + 1 else 1 end )
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。