I have got 2 tables, A, B
A: id is primary key and indexed
id, type_id, status
------------------
1, 1, True
2, 1, False
3, 2, False
...
B: (Type) type_id is primary key and indexed
type_id, param
----------
1, 23
2, 35
3, 24
I would like select all rows in B
which has at least 1 associated entry in A
with status True
select distinct B.id, B.param
from B
join A on A.type_id = B.type_id
where A.status = true
Is this a good way?