2015-11-27 53 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'的數量以瞭解更多。 –