2015-11-27 54 views
0

我有2个表,表1和表2,都有一个“name”字段SQLite数据库选择一个领域,我的目标是要显示的名字是在ListView从两个表中的SQLite

类似于每个表
Cursor mCursor = db.rawQuery("select * from table1 JOIN table2 ON table1.name = table2.name where table2.name LIKE '%" + txtSearch + "%'", null); 

它只结果显示在表2 :(请帮

+0

哪些列确实ListView控件显示应该是显示? –

回答

-1

也许问题来自于您的加入语句可以如下尝试:?

select t1.* from table1 t1 INNER JOIN table2 ON t1.name = table2.name where table2.name LIKE '%" + txtSearch + "%'" 
+0

谢谢你的回应:)但是,我的searchview中键入“john”后,我的listview仍然是空白的 –

+1

@PeacegleMayor你应该发布用于从光标读取表1的代码。也许你可以记录'cursor'的数量以了解更多。 –