• 全部
  • 基础类
  • 应用实例
  • 新技术前沿

联合查询问题

global_boy 2005-08-06 03:45:18
select tusers_t.* from tusers,tusers_t where tusers_t.scardid=tusers.scardid;
以上语句可以实现查询表tusers_t和表tusers字段scardid相同的数据;

请问如何查询表tusers_t有,而表tusers没有的scardid?
...全文
46 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
kadeya 2005-08-06
select scardid
from tusers_t
where scardid not in (select scardid from tusers)
回复
QQMagicer 2005-08-06
select *
from tusers_t
where tusers_t.scardid not in(select tusers.scardid from tusers)
回复
tangqijun199 2005-08-06
select tusers_t.* from tusers_t b left join tusers a on b.scardid=a.scardid;
where a.主键 is null
回复
fhuibo 2005-08-06
select tusers_t.* from tusers,tusers_t where tusers_t.scardid<>tusers.scardid
回复
lovewindy 2005-08-06
select tusers_t.* from tusers_t where scardid not in (select scardid from tusers)

好像这样也可以吧,
回复
xiaonvjing 2005-08-06

请问如何查询表tusers_t有,而表tusers没有的scardid?

select a.scardid,b.scardid from tusers_t a left join tusers b on a.scardid=b.scardid where b.scardid is null
回复
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2005-08-06 03:45
社区公告
暂无公告