Select records in on table based on conditions from another table?

前端 未结 2 901
日久生厌
日久生厌 2020-12-31 07:35

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)          


        
2条回答
  •  渐次进展
    2020-12-31 08:05

    SELECT B.*
    FROM B
    WHERE B.type_id
    IN 
    ( SELECT A.type_id 
      FROM A WHERE status='True'
    );
    

提交回复
热议问题