获得mysql表所有项目_mysql如何从表A中选择项目,其中表B中的所有相应项目满足条件(mysql how to select items from Table A where all corre...

I need to obtain all elements m_id of Table A where m_active is = N and that the corresponding elements in Table B have ALL v_active = N.

m_id is foreign key in Table B.

In the example below, what I am looking for is m_id=2 and and m_id=4 as both satisfy the condition of being m_active=N and have ALL v_active = N.

How do I go about that?

Thanks

Table A example:

m_id m_active

1 Y

2 N

3 Y

4 N

Table B example:

v_id m_id v_active

1 1 N

2 1 Y

3 1 N

4 2 N

5 2 N

6 2 N

7 3 N

8 3 Y

9 3 Y

10 4 N

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值