Hi m_min,
Would you like to sort the table of your database or the indicator with the elements of the table? For the first one your Database Managementsystem does the complete query optimization - you only have to set your primary keys and for columns which are often selected you can define indizes to optimize the performance of the query. For the second one you can use arrays where you store your online data. Via a SELECT COUNT(*) FROM AA ORDER.... you can search if the count of rows have changed. If so query the difference of rows via the primary key column (usually a continious integer) and add the result to your array - now you can do a array-sort.
Would this advice do what you want?
HTH
--
Joachim