我有数据库
public static final String DB_TABLE_EXERCISES = "exercises";
public static final String EXERCISE_COLUMN_ID = "_id";
public static final String EXERCISE_NAME = "exercise_name";
public static final String EXERCISE_ADVICE = "exercise_advice";
public static final String EXERCISE_DESCRIPTION = "exercise_description";
public static final String EXERCISE_IMAGE = "exercise_image";
public static final String EXERCISE_IMAGE_TWO = "exercise_image_two";
public static final String EXERCISE_IMAGE_PATH = "exercise_image_path";
public static final String EXERCISE_RELATE_TO_GROUP = "exercise_relate_to_group";
public static final String DB_EXERCISE_CREATE = "create table "
+ DB_TABLE_EXERCISES + "(" + EXERCISE_COLUMN_ID
+ " integer primary key autoincrement, " + EXERCISE_NAME
+ " text, " + EXERCISE_ADVICE + " text, " + EXERCISE_DESCRIPTION
+ " text, " + EXERCISE_RELATE_TO_GROUP + " integer, "
+ EXERCISE_IMAGE_PATH + " text, " + EXERCISE_IMAGE + " integer, "
+ EXERCISE_IMAGE_TWO + " integer);";
public static final String DB_TABLE_PROCESS = "process";
public static final String PROCESS_ID = "process_id";
public static final String PROCESS_TRAINING = "process_training_id";
public static final String PROCESS_EXERCISE = "process_exercise";
public static final String PROCESS_WEIGTH = "process_weigth";
public static final String PROCESS_COUNT = "process_count";
public static final String PROCESS_DATE = "process_date";
private static final String DB_PROCESS_CREATE = "create table "
+ DB_TABLE_PROCESS + "(" + PROCESS_ID
+ " integer primary key autoincrement, " + PROCESS_TRAINING
+ " integer, " + PROCESS_EXERCISE + " integer, " + PROCESS_WEIGTH
+ " double, " + PROCESS_COUNT + " integer, " + PROCESS_DATE
+ " date);";
比我创建从表中返回记录的方法,
public Cursor getHistoryByExerciseId(int id) {
Cursor c;
String sqlQuery = "SELECT process.process_count, process.process_weigth, process.process_date FROM "
+ "exercises INNER JOIN process ON process.process_exercise=exercises._id = "
+ String.valueOf(id) + ";";
c = mDB.rawQuery(sqlQuery, null);
return c;
}
但是当我尝试这个时 - 我得到了错误java.lang.RuntimeExeption: Unable to resume activity {HistoryListActivity}java.lang.IllegalArgumentException: column '_id' does not exist
cursor = db.getHistoryByExerciseId(1);
startManagingCursor(cursor);
scAdapter = new SimpleCursorAdapter(this, R.layout.history_item, cursor, from, to);
exersiceHistoryList.setAdapter(scAdapter);