Printing the all the sorted field values in a mysql column ( in java) -


i have table this

+-----------+-------------+ | attribute | score       | +-----------+-------------+ | camera    |   0.0819958 | | display   |    0.327983 | | model     |     0.70521 | | ram       | 0.000304832 | +-----------+-------------+ 

i want sort attributes according score , want print of them. when execute below code 1 value. please help.

string tb = "select attribute qvtemp order score desc "; statement = con.getconnection().preparestatement(tb); resultset rs5 = statement.executequery(); string g = null; while (rs5.next()) {     g = rs5.getstring(1);     }  system.out.println(g); 

change following from:

while (rs5.next()) { g = rs5.getstring(1); }  system.out.println(g); 

to

while (rs5.next()) {     g = rs5.getstring(1);     system.out.println(g);//bring in loop } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -