我有這個表:SQLiteDatabase需要幫助查詢......請
id | CUPNAME | FRENCHNAME
1 | 2 | null
2 | null | 4
我想拉從CUPNAME和FRENCHNAME數據是不爲空。 該表可以填充有數字1至10在該示例中,應當能夠CUPNAME = 2,FRENCHNAME = 4
有這樣的查詢:
SELECT sum(ifnull(french_press_bd.CUPNAME,0)) as a , sum(ifnull(french_press_bd.FRENCHNAME,0)) as b FROM my_table WHERE id in (1,2)
我嘗試寫所以這是行不通的:
String sqr = "id in (1,2)";
Cursor cursor = sqdb.query(french_press_bd.TABLE_NAME, new String[] {
"sum(ifnull(french_press_bd.CUPNAME,0)) as a , sum(ifnull(french_press_bd.FRENCHNAME,0)) as b"
},sqr, null,null,null,null);
你需要給兩個字符串(每列一個),但你是什麼真正想要的? –
我想從表中引入一行數據,刪除值爲空 – comSaaxov
請編輯您的問題以顯示輸入表和所需的輸出。 –