Getting last record from mysql
Almost done. You succeed in getting the insert order. So: select myId, @rowid:=@rowid+1 as myrow from maxID, (SELECT @rowid:=0) as init ORDER BY myrow desc LIMIT 1; In my console I get the following: mysql> select myId, @rowid:=@rowid+1 as myrow from maxID, (SELECT @rowid:=0) as init ORDER BY myrow desc LIMIT 1; +——+——-+ | myId … Read more