Hi guys can anyone tell me if it is possible to sort integer values for smallest to biggest which has been stored in my database as Strings. What I want to do is list my items in an textarea that sorts the numbers from smallest to biggest.

Also note if anyone has an update statement that works with ms Access which through multiple tables this would also solve my problem. As I had to delete previous values and insert new values for my ID's therefore my database went out of order. So if you know how to use the update statement through multiple tables that would solve my problem

Edited 4 Years Ago by TIM_M_91: n/a

in which case, you could have done a better job on your DB.
but if I'm correct, you have a table with (for instance)
"385" (element 1)
"21" (element 2)
"128" (element 3)

and you want to sort it so, that it becomes
"21" (element 1)
"128" (element 2)
"385" (element 3)
?

well, you could use the compareTo method, or you could parse to int, sort 'm that way and do String.valueOf(myIntValue);
when you write it to your DB

in which case, you could have done a better job on your DB.
but if I'm correct, you have a table with (for instance)
"385" (element 1)
"21" (element 2)
"128" (element 3)

and you want to sort it so, that it becomes
"21" (element 1)
"128" (element 2)
"385" (element 3)
?

well, you could use the compareTo method, or you could parse to int, sort 'm that way and do String.valueOf(myIntValue);
when you write it to your DB

I don't think I fully explained my question. First of all my numeric values are stored as Strings. What I want to do is for when I list the items in my textarea that the items are listed from smallest to biggest. I had to do it this way as I couldn't find a solution for my update statement for multiple tables that actually worked. Therefore I had to delete previous values and insert new values for my ID's therefore my database went out of order. So if you know how to use the update statement through multiple tables that would solve my problem.

you can apply any sorting algorithms to your database, changing the normal comparison < = > to compareTo.

you can apply any sorting algorithms to your database, changing the normal comparison < = > to compareTo.

So what would I need to change to this:

ResultSet res = stmt.executeQuery("SELECT * FROM VIDEOS ORDER BY VIDEOID");

nothing, you're not going to sort in your DB, you're just sorting the results that are contained in that ResultSet

This article has been dead for over six months. Start a new discussion instead.