mysql - 下面語句用left join 還是用not in?
PHP中文网
PHP中文网 2017-06-06 09:52:24
0
2
1011

實作:查詢a中沒有關聯b的記錄

1、select id from a left join b on a.id = b.aid where b.id is null and status = 1
2、select id from a where id not in (select aid from b) and  status = 1

那種更好,或有其他的方式,請大神留下答案

PHP中文网
PHP中文网

认证0级讲师

全部回覆(2)
小葫芦

不存在正確答案

雷雷
習慣沉默

我想使用 not exists

淺談sql中的in與not in,exists與not exists的區別

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!