我将此SQL与“UNION”相关联。 “FROM”部分被省略。此SQL生成批处理文件,其中命令的顺序很重要。
SELECT 'DISCONNECT ent_user FROM job_code WITH user_id ="'
|| a.user_id
|| '" , jc_name = "'
|| b.jc_name
|| '";'
FROM
[...]
UNION
SELECT 'DISCONNECT rss_user FROM user_group WITH rss_user_name = "'
|| a.user_id
|| '" rss_name = "'
|| b.rss_name
|| '" rss_type = "'
|| b.rss_type
|| '" , ug_name = "'
|| b.ug_name
|| '";'
FROM
[...]
UNION
SELECT 'DELETE rss_user WITH rss_user_name = "'
|| a.user_id
|| '" rss_name = "'
|| b.rss_name
|| '" rss_type = "'
|| b.rss_type
|| '";'
FROM
[...]
我希望这样排序。这是手动不是ASC或DESC。
1) DISCONNECT ent_user FROM job_code ...
2) DISCONNECT rss_user FROM user_group ...
3) DELETE rss_user WITH rss_user_name
怎么做?
答案 0 :(得分:7)
选择一个文字数字列和您的代码,然后按顺序排序:
SELECT code_text
FROM (
SELECT <code> AS code_text, 1 AS my_order
...
UNION
SELECT <code> AS code_text, 2 AS my_order
...
[etc.]
)
ORDER BY my_order;
然后您可以设置任何您想要的订单。
希望它有所帮助...