Android Question SQLite 999 records

anaylor01

Well-Known Member
Licensed User
Longtime User
When I run select max(id) from Table it returns 999. I know there is more than that. I think there is a limit that needs to be set to increase this but not sure what it is or how.
 

mangojack

Expert
Licensed User
Longtime User
What data type is column(id)
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
int identity. There are over 4000 records and the id goes up to 4000. So when I run that query I would expect to see 4000 not 999.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to give more information !
Try this request:
Cursor1 = SQL1.ExecQuery("SELECT * FROM YouTable"
Log(Cursor1.RowCount)
What value do you get ?
Are all rows of the id column filled ?

If in max(id) id is an INTEGER PRIMARY KEY, be aware that max(id) will return the max value which is not always equal to the number of rows.
With INTEGER PRIMARY KEY, if you remove a row the id values remain the same.
This means that the max value doesn't change but the number of rows is minus 1.
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
That was the problem. When I imported the data back in it removed the data types. I changed it back to an int and it works fine. Thanks guys.
 
Upvote 0
Top