I have this SQL with "UNION". The "FROM" part is omitted. This SQL generates a batch file where the order of commands is important.
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
[...]
I wish to have this sorting. This is manually not ASC or DESC.
1) DISCONNECT ent_user FROM job_code ...
2) DISCONNECT rss_user FROM user_group ...
3) DELETE rss_user WITH rss_user_name
Howto do that?
Select a literal numeric column along with your code and then order by that:
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;
You can then set any order you want.
Hope it helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With