为了账号安全,请及时绑定邮箱和手机立即绑定

我现在想要获得a表的数据,且这些数据对应表的数据del不能为true ?该怎么做?

我现在想要获得a表的数据,且这些数据对应表的数据del不能为true ?该怎么做?

LEATH 2023-03-21 11:17:51
有三个表a,b,c a表的架构是 id   atype   rid 1     b       1 2     c       1 3     c       2 4     b       2 5     b       3 6     c       3 atype中的b,表示这条代表是b表的, c表示c表的 b表的结构是 id   del 1    true 2    false 3    false c表 id   del 1    true 2    false 3    false 如查询结果 id   atype   rid 3     c       2 4     b       2 5     b       3 6     c       3 直接来说数据过滤一下 
查看完整描述

1 回答

?
慕尼黑8549860

TA贡献1818条经验 获得超11个赞

  1. SELECT * from   

  2. (SELECT a.id,a.atype,a.rid from a,b where a.rid = b.id and a.atype = 'b' and b.del = 'false'  

  3. union  

  4. SELECT a.id,a.atype,a.rid from a,c where a.rid = c.id and a.atype = 'c' and c.del = 'false') tbl  

  5. order by tbl.id asc  



查看完整回答
反对 回复 2023-03-24
  • 1 回答
  • 0 关注
  • 121 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号