问题
I want to sort according to date first and then if date is similar then according to id..How to do that in Informix/HSQL query?
回答1:
SELECT FIELD1, FIELD2 FROM TABLE ORDER BY FIELD1 ASC, FIELD2 ASC
A good tutorial on this SQL ORDER BY
回答2:
Try this(adjusted to your needs):
SELECT * FROM table ORDER BY datecol ASC, id ASC
回答3:
This should work:
SELECT * FROM Table
ORDER BY date, id;
回答4:
Does
[rest of query] order by date, id
work?
回答5:
select * from (select * from tablename order by col1) order by col2
来源:https://stackoverflow.com/questions/8532599/need-to-perform-order-by-twice