【发布时间】:2017-03-01 20:33:24
【问题描述】:
我需要先在列表中显示一组结果,然后再显示下表中的其余结果。
我尝试过SQL: how to use UNION and order by a specific select?,但在我的情况下似乎不起作用。
我的查询如下所示
SELECT * FROM (
SELECT id, display as ordered
FROM table
WHERE id in (...) --these need to be first
UNION
SELECT id, display
FROM table
WHERE id not in (...) --these need to be at the end
)
ORDER BY ordered
无论我做什么,我的结果都会按显示顺序返回。
顺便说一句,我正在使用 Oracle。
感谢您的帮助。
【问题讨论】: