我正在android中創建一個消息應用程序,我只想從唯一的聯繫人號碼獲取短信。使用Distnict和getContentREsolver android Sqlite
我試過下面的代碼,但它不工作。
String[] projection = new String[] { "_id","DISTINCT "+ContactsContract.PhoneLookup.NUMBER, "person", "body", "date", "type" };
Cursor cursor = getContentResolver().query(uri, projection,null, null, null);
它在這裏拋出錯誤。
Caused by: android.database.sqlite.SQLiteException: near "DISTINCT": syntax error: , while compiling: SELECT _id, DISTINCT number, person, body, date, type FROM sms ORDER BY date DESC
有人可以爲我解開這個。
請參閱[this](https://www.sqlite.org/lang_select.html) – pskink
Android版本的最低要求是多少? –