我正在尝试使用查询中的值初始化游标。该查询旨在返回表2中不在表2中的内容。为此,我使用了return db.rawQuery("select _id, ingredient_name, measurement, unit from ingredients where recipe_code = " + recipe_code +
" MINUS select ingredient_name, measurement, unit from kitchen", null);
子句,但它似乎没有工作,我看不出我出错的地方。
查询
02-05 11:35:05.189 29028-29028/com.example.rory.prototypev2 E/AndroidRuntime: android.database.sqlite.SQLiteException: near "MINUS": syntax error (code 1): , while compiling: select _id, ingredient_name, measurement, unit from ingredients where recipe_code = 11 MINUS select ingredient_name, measurement, unit from kitchen
错误
addEventListener
答案 0 :(得分:1)
您可以使用EXCEPT子句。在sqlite中支持。在Docs中,我找不到用于sqlite的MINUS
select _id, ingredient_name, measurement, unit from ingredients where recipe_code = " + recipe_code + " EXCEPT select ingredient_name, measurement, unit from kitchen"
感谢。
答案 1 :(得分:0)
SQLite中没有这样的运算符。 SQLite Expressions