我有这张桌子:
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 );