Many To Many Search in Table

User Table

Userid Username
1 Name1
2 Name2
3 Name3

Subscription Table

SubId SubName
1 Subname1
2 Subname2

User_Subscription Table

Userid SubId
1 1
1 2
2 2
3 1

Many To Many Search Format1

How Many users Subscripted in 1 or 2

SELECT Userid,SubId, count(*) as countt FROM User_Subscription e where
Subscripted in (2,1) group by Userid;

Many To Many Search Format2

How Many users Subscripted in 1 and 2

SELECT Userid,SubId, count(*) as countt FROM User_Subscription e where
Subscripted in (2,1) group by Userid having countt=2;