I have a database that I want to sort but I dont really understand how to use the ORDER BY field when I query. the only thing I have done with it is sort a column using ASC or DEC but beyond that I dont know how to use is.
what I want to do is when I query the database I want to sort it by a column that holds a number in milliseconds from the one that is the closest to the current time ie. system.currentTimeMills() - timeInDb to the one that is the furthest away.
anyone want to point me in the right direction?
The ORDER BY keyword is used to sort the result-set by a specified column.
The ORDER BY keyword sort the records in ascending order by default.
If you want to sort the records in a descending order, you can use the DESC keyword.
For eg:
will order rows by descending order, which is what you seem to want.