Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

Java Android SQLite Alternative to offset, Android

views
     
TSmeiyi
post Sep 27 2015, 05:06 PM, updated 9y ago

Regular
******
Senior Member
1,403 posts

Joined: May 2013


Is there any way to offset data starting from the bottom of the data?

Offset happens where it removes the first data on top, but could it possible to remove data starting from the bottom.

I tried limit, but it deleted my first few latest records.

user posted image

I wanted to get the latest record and omit the old records. Actually I wanted to do a listview where it display the top 3 latest records.

user posted image

And when the user click the load more button, the other messages will appear. But when a new message appear, the top 3 messages will not be replaced by the new records, instead display the top 3 messages + new records until the user click refresh and the record will query the latest top 3 records.

Thank you.
malleus
post Sep 27 2015, 08:20 PM

Look at all my stars!!
*******
Senior Member
2,096 posts

Joined: Dec 2011
try...

select * from records order by id desc limit 3

where id should be your incremental row ID. that'll get you the latest 3 which you can then offset from. but it'll return the latest row first

 

Change to:
| Lo-Fi Version
0.0158sec    0.37    5 queries    GZIP Disabled
Time is now: 28th March 2024 - 09:24 PM