我需要从表中选择一些列,其中某个列(在我的情况下为 pos_report_id)为空,而不是 null。我在 SQLiteDatabaseBrowser 中尝试了这段代码(对于 user_id='23'),它工作正常:
"SELECT information_action.target_type, information_action.message_type,"
+ "information_action.start_date, information_action.end_date, information_action.content, information_action.status "
+ "FROM information_action INNER JOIN information_to_user ON "
+ "information_to_user.information_action_id = information_action.id_information_action "
+ "WHERE information_action.pos_report_id ='' AND information_to_user.user_id ='"
+ user_id + "'";
但在代码中,当我运行应用程序时出现此错误:
ERROR AndroidRuntime Caused by: android.database.sqlite.SQLiteException: near "": syntax error: , while compiling: SELECT information_action.target_type, information_action.message_type,information_action.start_date, information_action.end_date, information_action.content, information_action.status FROM information_action INNER JOIN information_to_user ON information_to_user.information_action_id = information_action.id_information_action WHERE information_action.pos_report_id ='' AND information_to_user.user_id ='23'
知道如何解决这个问题吗?为什么''不行?