求一条SQL语句实现关联查询

喜欢黄家驹 2009-01-01 11:38:21
tableA :
fdate fid content
2008-1-1 12 update files
2008-1-2 22 create files
2008-1-3 33 delete files
。。。 。。。 。。。
TableB:
stime sid solution
2008-1-1 12 setdown
2008-1-2 22 miss
2008-1-3 44 holdon
... ... ...
求两条SQL语句
第一条实现:查出 在TableA中 fdate , fid 都不等于TableB中 stime , sid 中的记录;
第二条实现:删除TableA中fdate , fid 都等于TableB中 stime , sid 中的记录;
谢谢各位了,元旦加班中!
祝各位新年快乐,心想事成!
...全文
418 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
喜欢黄家驹 2009-01-01
  • 打赏
  • 举报
回复
成功 !谢谢 !
我是菜鸟!临时表?
请问这方面的学习资料 从哪找啊?
-狙击手- 2009-01-01
  • 打赏
  • 举报
回复
1\
select *
from tablea a
where not exists(select 1 from tableb where stime = a.date and sid = a.fid)
2\
delete a
from tablea a
where exists(select 1 from tableb where stime = a.date and sid = a.fid)

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧