-1
Cursor ck = db.rawQuery("select name,title,text,type from abstracts_item,abstract_author,authors_abstract where abstract_author._id == authors_abstract.abstractauthor_id and abstracts_item._id ==  authors_abstract.abstractsitem_id", null);

我用其他 sqlite 工具运行了同样的查询。它工作得很好。但是,当我尝试使用 with 时cursor。我有一个错误

java.lang.IllegalArgumentException: column '_id' does not exist

我得到了很多解决方案。但是,没有什么对我有用。如果你们帮我解决这个问题,我会很高兴。

4

1 回答 1

0

SQL 语言不使用==,而是使用=.

所以它s/b:

Cursor ck = db.rawQuery("select name,title,text,type from
abstracts_item,abstract_author,authors_abstract where abstract_author._id =
authors_abstract.abstractauthor_id and abstracts_item._id =
authors_abstract.abstractsitem_id", null);

您还可以通过使用内部联接而不是 where 子句来提高性能:

Cursor ck = db.rawQuery("select name,title,text,type from abstracts_item 
    inner join abstract_author on abstract_author._id = authors_abstract.abstractauthor_id
    inner join authors_abstract on abstracts_item._id = authors_abstract.abstractsitem_id", null);
于 2013-07-25T19:27:23.177 回答