1

尝试通过“ID”对从内容提供商接收的数据进行排序时出现此错误:

android.database.sqlite.SQLiteException: ambiguous column name: _id (code 1): , while compile: SELECT anydo_tasks.due_date, anydo_tasks.title, anydo_categories.name AS category_name, anydo_tasks._id, anydo_tasks.status, anydo_tasks.priority FROM anydo_tasks INNER JOIN anydo_categories ON anydo_tasks.category = anydo_categories._id WHERE (status <> 0 AND parent_task_id IS NULL ) AND (status=?) ORDER BY _id ASC

我正在运行的代码是这样的:

String orderBy = TasksContract.TasksColumns.ID + " ASC";

mCursor = mContext.getContentResolver().query(TasksContract.TASKS_URI, null,TasksContract.TasksColumns.STATUS + "=?", new String[]{String.valueOf(TasksContract.STATUS_UNCHECKED) }, orderBy, null);

我在这里看到了其他问题,指出这可能是因为两个表使用 ID,但在我的查询中,我很确定我指定了正确的表。这里发生了什么?

4

0 回答 0