oracle手写排序
时间: 2023-08-24 21:11:23 浏览: 127
在Oracle中,可以使用ORDER BY子句对查询结果进行手写排序。根据你提供的两个例子,可以看出在ORDER BY子句中,可以使用表的列名进行排序。例如,根据第一个例子中的statues_row字段进行排序,可以使用以下语句:
SELECT * FROM (SELECT * FROM table ORDER BY statues_row DESC) WHERE ROWNUM < 4;
在第二个例子中,根据pm.creation字段进行排序,可以使用以下语句:
SELECT pm.MODEL_ID AS "modelId", pm.MODEL_NO AS "modelNo", pm.MODEL_TYPE_CN AS "modelTypeCn", pm.MODEL_TYPE_EN AS "modelTypeEn", pm.PROD_IMG_URL AS "prodImgUrl", pm.MODEL_BASE_TYPE AS "modelBaseType", pm.STATUS AS "status" FROM t_hog_product_models pm ORDER BY pm.creation DESC;
通过在ORDER BY子句中指定要排序的列名和排序顺序(ASC表示升序,DESC表示降序),可以实现手写排序。
#### 引用[.reference_title]
- *1* [Oracle分页排序数据混乱原因及解决](https://blog.csdn.net/xiaoxiaovbb/article/details/121332041)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Oracle 分页混乱解决](https://blog.csdn.net/gjklop/article/details/79310397)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文