I understood that the GROUP BY
clause is no longer supported in Android ICS (https://stackoverflow.com/questions/8837544/android-ics-sqlite-error). Anyone with an idea what to use instead? I'm using a ContentProvider
, not querying the DB directly.
Here is a sample query that used to work on Android versions lower than ICS. Any ideas how to rewrite it?
Cursor cursor = activity.getContentResolver().query(Data.CONTENT_URI, // from
new String[] { StructuredPostal._ID, StructuredPostal.CITY, StructuredPostal.COUNTRY }, // select
Data.MIMETYPE + "='" + StructuredPostal.CONTENT_ITEM_TYPE + "' AND "
+ StructuredPostal.CITY + " <> '' " // where
+ ") GROUP BY (" + StructuredPostal.CITY
, null, // args
StructuredPostal.CITY + " ASC, " + StructuredPostal.COUNTRY + " ASC"); // sort by
EDIT: The error is Caused by: android.database.sqlite.SQLiteException: near "GROUP": syntax error:...