0

I want to select last 3 rows of my table and no id is defined and table is not sorted either. Put it this way without using order clause or I just want to reverse the records of my non ordered table.

user3666112
  • 63
  • 1
  • 6
  • Could you please give some details, table representation, and what you already tried ? – kenfire Aug 29 '17 at 10:02
  • Possible duplicate of [Get SELECT results ordered by "row id" in mySQL](https://stackoverflow.com/questions/18833661/get-select-results-ordered-by-row-id-in-mysql) – Ankit Bajpai Aug 29 '17 at 10:06

1 Answers1

0

Try this -

SET @rownum:=0;

SELECT *
FROM (SELECT @rownum:=@rownum+1 as rownum,*
      FROM yourTable) t1
ORDER BY rownum DESC
LIMIT 3;
Ankit Bajpai
  • 13,128
  • 4
  • 25
  • 40