简体   繁体   中英

Get the second last record from table

I have tables called names and it has only field called name . It has the following records in it

Ehsan
Malik
Ahmed
Zaryab
Hassan

Now, I have to get the second last record ( Zaryab ) from this table. How can I do that?

If I understand correct, your table doesn't have an id or indexed column. In that case there's not much to do, but to fetch all and get the second last row. However, even if you do that, there is no guarantee that you would get the same result each time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM