mysql获取表的行号

 select @rownum:=@rownum + 1 as rownum, tt.guid from (select guid from gcfr_t_vch t where t.type = 2 and t.curragency = '11') tt ,
(select @rownum := 0) m

类似于oracle中的rownum。如果业务表需要加where 条件,需要先查出来目标结果集当做一个表。因为(select @rownum :=0)m前面不能有where条件,只能是业务表。

posted @ 2018-08-16 13:36  土豆Z120553  阅读(2954)  评论(0编辑  收藏  举报