我想从 SQLite 表中检索最后插入的“n”行。我使用了以下查询,但出现错误,请帮助我更正我的查询。如果我的查询有误,请建议我一个更好的查询:
public Cursor readLastNDetails(int n)
{
return this.data.rawQuery("SELECT TOP ("+n+") Name,Place,occupation,Date from tb_Employee order by id DESC", null);
}
我想从 SQLite 表中检索最后插入的“n”行。我使用了以下查询,但出现错误,请帮助我更正我的查询。如果我的查询有误,请建议我一个更好的查询:
public Cursor readLastNDetails(int n)
{
return this.data.rawQuery("SELECT TOP ("+n+") Name,Place,occupation,Date from tb_Employee order by id DESC", null);
}
使用以下查询,
"select Name,Place,occupation,Date
from tb_Employee
order by id
desc limit"+ n
终于我得到了答案
public Cursor readLastNYield(int n)
{
return this.data.rawQuery("select BatchName,Yield,ActualYield,Date from tb_LabAssessment order by id DESC limit "+n, null);
}