我需要从表中选择某些列,其中某列(pos_report_id,在我的情况下)是空的,而不是空。我想在此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'
任何想法如何解决这个问题?为什么它不符合''?
问题不在user_id,它在pos_report_id。我必须检查pos_report_id是否为空。 – Gabrielle