user table table_1
id name sex status
1 1 1
2 1 1
user role rating table table_2
UID
id uid level_name level_id
1 1 1
1 1 2
1 2 2
1 2 3
query users of all bronze grades, so that there is no problem with single condition
SQL
select * from table_1 RIGHT JOIN table_2 ON table_1.id = table_2.uid
where table_1.status = 1 AND table_2.level_id = 1 group by table_1.id
but how to query roles that have both bronze and silver?
the following query conditions are not allowed
select * from table_1 RIGHT JOIN table_2 ON table_1.id = table_2.uid
where table_1.status = 1 AND table_2.level_id = 1
AND table_2.level_id = 2
how to query this condition?