Hi,
This has got me all confused! I'm trying to return the max value from a column in my database but the return value is always the name of the column.
The query I use:
private static final String SELECTMAX = "SELECT MAX(?) FROM " + TABLE_NAME ;
The (test) function to return the max value:
public int getMaxValue(String field){
int r = 0;
String f[] = new String[] {field};
Cursor c = this.db.rawQuery(SELECTMAX, f);
if (c.moveToFirst()) {
String s = c.getString(0);
Log.i("XXXXX","Max num: " + s);
}
return r;
}
The column i'm querying is an INTEGER type but the result 's' is always the column name and not the desired value.
Thanks