public long getLastId(){
String query = "SELECT ROWID from "+TABLE_NAME+" order by ROWID DESC limit 1";
Cursor c = db.rawQuery(query,null);
long lastId=0;
if (c != null && c.moveToFirst()) {
lastId = c.getLong(0); //The 0 is the column index, we only have 1 column, so the index is 0
}
return lastId;
}
SQL 获取某张表最后一行的ID
猜你喜欢
转载自blog.csdn.net/qq_27494201/article/details/130419444
今日推荐
周排行