ORDER BY 子句
ORDER BY 子句指定结果集合中的对象的排列次序
使用语法:
ORDER BY [ order_element ,]* order_element order_element ::= { path-expression | integer } [ ASC | DESC ]
路径表达式必须指定单个值的字段,该字段的基本类型为:byte、short、int、long、float、double、char,或其包装器类型为 Byte、Short、Integer、Long、Float、Double、BigDecimal、String、Character、java.util.Calendar、java.util.Date、java.sql.Date、java.sql.Time、java.sql.Timestamp。
ASC 指定升序,并且是缺省值。DESC 指定降序。
Integer 指 SELECT 子句中的选择表达式。
示例:ORDER BY 子句
按 deptno 的降序返回部门对象:
SELECT OBJECT(d) FROM DeptBean d ORDER BY d.deptno DESC
返回按部门号和名称排序的职员对象:
SELECT OBJECT(e) FROM EmpBean e ORDER BY e.dept.deptno ASC, e.name DESC