i have a following PREFERENCE_SCORE
table
ID(int) | SCORE(Double) | RANKING(int) |
I want to insert into database using the following code
String sql = "INSERT INTO PREFERENCE_SCORE_ ( ID,
SCORE,RANK) VALUES (?,?,?) ";
String query ="SELECT ID,FPIS,FNIS FROM db_housekeep";
ResultSet rsp = stats.executeQuery(query);
while(rsp.next()){
int id = rsp.getInt(1);
double fpis = rsp.getDouble(2);
double fnis = rsp.getDouble(3);
prSt.setInt(1, id);
prSt.setDouble(2, fnis/(fnis+fpis));
prSt.setInt(3, THIS PART i dont understand)
prSt.executeUpdate();
}
What should i add so the RANKING
column is automatically filled by the rank of the data according to the SCORE
column?