mysql(union和union all)
union和union all 合并2条或者多条sql:
union 合并后会踢重
union all 合并后有不会踢重
SELECT * FROM t_mp_resources WHERE id in
(SELECT DISTINCT resId FROM (
SELECT resId FROM t_mp_user_res WHERE userId = 1
UNION ALL
SELECT resId FROM t_mp_role_res WHERE roleId in (SELECT roleId FROM t_mp_user_role WHERE userId= 1)
)
tmp
)