How to execute UNION without sorting? (SQL)

前端 未结 10 870
猫巷女王i
猫巷女王i 2021-01-30 21:34

UNION joins two results and remove duplicates, while UNION ALL does not remove duplicates.
UNION also sort the final output.

W

10条回答
  •  无人共我
    2021-01-30 22:03

    You can do something like this.

    Select distinct name from  (SELECT r.name FROM outsider_role_mapping orm1 
        union all
    SELECT r.name FROM user_role_mapping orm2
    ) tmp;
    

提交回复
热议问题