Clicky

mySql - Get N Top rows

January 2, 2011

In mySql to return the first N rows execute the following:

  • select * from <table_name> limit N;

Besides, mySql as a very useful feature, the “offset” in conjunction with “limit” may let define any interval that you desire, for instance to return rows 10 to 20:

  • select * from <table_name> limit 10 offset 10;