我在Android上使用SQLite.
我曾经ContentProvider从db查询数据.现在,我尝试使用子查询时遇到问题ContentResolver
String selection = "cat_id NOT IN ?"
String[] selectionArgs = new String[]{"(SELECT Categories.id FROM Categories)"}
cursor = mResolver.query(getContentUri(), getListColumns(),
selection, selectionArgs, orderBy);
Run Code Online (Sandbox Code Playgroud)
这是错误:
08-06 10:32:36.070: E/AndroidRuntime(2151): Caused by: android.database.sqlite.SQLiteException: near "?": syntax error (code 1): , while compiling: SELECT * FROM TRANSACTIONS WHERE cat_id NOT IN ? ORDER BY time_created ASC, id ASC`
Run Code Online (Sandbox Code Playgroud)
我的问题是"我可以使用selectionArgs作为子查询吗?"
我的目的是"获取cat_id不在类别表中的事务列表".
谁能帮我?