我正在使用 SugarORM 来管理数据库。
public class ExerciseDB extends SugarRecord
{
@Column(name = "ex_recordId", unique = true, notNull = true)
private String ex_recordId;
private String ex_group;
private String ex_name;
private int ex_cal;
public ExerciseDB()
{
}
public ExerciseDB(String ex_recordId, String ex_group, String ex_name, int ex_cal)
{
this.ex_recordId = ex_recordId;
this.ex_group = ex_group;
this.ex_name = ex_name;
this.ex_cal = ex_cal;
}
然后将默认事务加载到ExerciseDB,如下:
ExerciseDB e1= new ExerciseDB("ex1", "Group1", "aaa", 190); save(e1);
ExerciseDB e2= new ExerciseDB("ex2", "Group1", "bbb", 180); save(e2);
问题:
我想列出请求的交易条件到列表视图。
虽然我知道如果检索所有条目可以按如下方式完成:
List<ExerciseDB> Ex_db_record = null;
Ex_db_record = Select.from(ExerciseDB.class).orderBy("ex_recordId").list();
我怎样才能得到一个列表,例如,只有 Group1 记录和按顺序列出的列表ex_recordId
?我努力了
Ex_db_record = ExerciseDB.find(ExerciseDB.class, "ex_group = ?", groupping);
但它给出的错误如下:
Caused by: android.database.sqlite.SQLiteException: no such column: ex_group (code 1): , while compiling: SELECT * FROM Ex_Records WHERE ex_group = ?