Java MySQL Iterate Backwards through ResultSet -
i've executed query returns resultset
of data iterate backwards over. in loop this:
for (int = max; >=0; i--){ // }
the problem don't have a column in db sequential, instead have id unique, skips numbers. so, using actual result set, there way can while(set.next()) {...}
in reverse? thanks.
you can traverse resultset backwards if have scrollable resultset.you can doing
resultset.type_scroll_insensitive
, resultset.concur_read_only
when creating statement.
then can use resultset.last() last entry , traverse backwards using resultset.previous()
edit: if want results in descending order of non-sequential ids mentioned, can retrieve resultset in descending order doing order id desc
, traverse resultset normally
Comments
Post a Comment