select distinct user_seq from user_rol where role_num=3 and user_seq in (select user_seq from user_rol where role_num=7) and user_seq not in (select distinct user_seq from user_rol where role_num not in (3,7))
SELECT * FROM (SELECT * FROM aa WHERE id IN (SELECT id FROM aa GROUP BY id HAVING COUNT(id) > 1)) DERIVEDTBL WHERE (a = '3') OR (a = '7')
select User_Seq from user_roles a where a.role_num = 3 and exists ( select * from user_roles b where b.User_Seq = a.User_Seq and b.role_num = 7)
and user_seq in (
select user_seq from user_roles where role_num=7)
where role_num=3 or role_num=7
select * from user_roles where role_num=3
and user_seq in (
select user_seq from user_roles where role_num=7)
select user_seq
from user_roles
where role_num = 3 or role_num = 7
group by user_seq
having count(*) = 2
where role_num=3
and user_seq in (select user_seq from user_rol where role_num=7)
and user_seq not in
(select distinct user_seq from user_rol where role_num not in (3,7))
FROM (SELECT *
FROM aa
WHERE id IN
(SELECT id
FROM aa
GROUP BY id
HAVING COUNT(id) > 1)) DERIVEDTBL
WHERE (a = '3') OR
(a = '7')
where a.role_num = 3 and exists (
select * from user_roles b where b.User_Seq = a.User_Seq
and b.role_num = 7)