亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我現在想要獲得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 關注
  • 106 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號