SELECT @rownum:=@rownum+1 rownum, t.systemid,t.systemcode FROM(SELECT @rownum:=0,syssystem.* FROM syssystem ) t