Hey, I'm trying to query the words which have the maximul values in the cont columns. Ex: if the word "test1" has the value 5 in cont, and "test2" has 2, "test1" will be shown in first position. got it?
so. Im trying to do it but it returns the following error:
09-18 22:24:04.072: ERROR/AndroidRuntime(435): Caused by: android.database.sqlite.SQLiteException: misuse of aggregate function MAX(): , while compiling: SELECT word FROM words WHERE MAX(cont) ORDER BY cont desc
Here is my method:
public List<String> selectMaxCont(){
List<String> list = new ArrayList<String>();
Cursor cursor = this.db.query(TABLE_NAME, new String[]{"word"}, "MAX(cont)", null, null, null, "cont desc");
if(cursor.moveToFirst()){
do{
list.add(cursor.getString(0));
}while(cursor.moveToNext());
}
if(cursor != null && !cursor.isClosed()){
cursor.close();
}
return list;
}