Yeah, HTML is just a mark-up language, meaning it only specifies to the browser how to format a block of text. An "ordered list" just means a list that is assumed to have some sort of order (like a list of instructions, hence the typical rendering with sequential numbers 1, 2, 3, ...) HTML markup can't actually change the physical order of a list of items.
Anything where the block of text is dynamically generated or altered (and that includes changing the sort order of a list) must be done using some other program which does the change and then generates the appropriate HTML code, whether it's data pulled from an SQL query, or a PHP script, or a Javascript, or whatever.
That's another option too, you could probably find some Javascript code that could read the contents of a table and dynamically sort them.