Android Question SQLite set rowid new on a order by command

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

Because i work with the ROWID, is this a issue if the data change to a newer value and nothing happend, when i load all components new.

This does not work.
B4X:
SQL1.ExecQuery("SELECT column1, column2 FROM table1 WHERE rowid=" & (i +1) & " ORDER BY time DESC")

Is there a way to reorder the rowid so that the newest time gets rowid 1?

if come a newer time from the database, i just update the row and reload new.

Greetings
 

klaus

Expert
Licensed User
Longtime User
Is there a way to reorder the rowid so that the newest time gets rowid 1?
No, you cannot.
Every time you add a new record rowid is incremented by one.
If you delete records, their rowids are lost all the other remain.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
I always use primary keys that autoincrement
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
What are you trying to accomplish? Since you include rowid in your query with an equals comparison operator, this will return either one or zero results (one if the rowid exists and zero if not). So why the need for ORDER BY? Again, what are you trying to accomplish?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…