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条件,只能是业务表。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM