注册账号 登录
用友之家-用友软件论坛 返回首页

oracledb的个人空间 https://www.oyonyou.com/?240459 [收藏] [复制] [分享] [RSS]

日志

sql语句 查询一个表中的某个字段的值不包括另一个表中的某个字段的所有值

已有 896 次阅读2012-10-21 21:36 |个人分类:数据库

select *
from 表A
where id not in (select id from 表B)

但是not in 效率不高,建议用:

select a.*
from A
left join B on a.id=b.id
where isnull(b.id)
 
 
 
 
 
 

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册账号

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-6-4 07:53 , Processed in 0.019004 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部