I have the following statement Select person, age from people order by age desc Select person, score from people order by score desc Code (markup): Is it possible to put these two query in single select statement? Thanks in advance...
Well, yes, but you won't get two distinct order by. You can do an order by age, score, and the result will be ordered by age, and if there is equal age then score. However, depending on how you present the data, you could add sorting options on the data on the page.
If you only want to sort on age, then just do Select person, age, score from people order by age desc Code (markup): Although that there is bad database design. While age can be argued could be part of the person-table, at least the score should be in its own table, linked by unique IDs.
This would sort by age descending first, then score descending second: SELECT person, age, score FROM people ORDER BY age DESC, score DESC Code (markup):
What he said, and bonus points for following the naming convention of commands in uppercase and fields in lowercase so you can tell what the **** is going on in there.