How can I use resultset to get me the minimum, average or maximum value from a mysql database column?
I have a prepared statement sql constant string = Select avg(EntryValues) from Entries;
I know I need to use a resultset.getString(EntryValues) but I dont know how to build the java method that would return the actual average value from that resultset.next() loop thing…
Could you please help me?
statementfrom yourconnectionuse the
statement.executeQuery()method to invoke your query and assign it to yourResultSet, e.g.Your result is one simple ‘row‘ therefore you can use
If your result contains multiple rows you’ll have to use a while-loop for example to iterate through all the result entries:
Hope this helpes, have Fun!