一个简单的sql语句。马上给分!

xiaoduo 2003-10-16 04:06:02
table1:中有s1,s2,s3,s4,s4几个字段
table2中有a1,s1,2,a3,a4,a4几个字段
我现在想要做的是
如果table2中的s1,和table1中的s1相同的话,我就把table1中的相应的删掉
这个sql语句该如何写

...全文
24 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bsccxf 2003-10-16
  • 打赏
  • 举报
回复
delete from table1 where s1 in (select distinct s1 from table1)
zjcxc 元老 2003-10-16
  • 打赏
  • 举报
回复

delete from table1 where s1 in(select s1 from table2)
pengdali 2003-10-16
  • 打赏
  • 举报
回复
delete table1 where s1 in (select s1 from table2)

写反了 :(
pengdali 2003-10-16
  • 打赏
  • 举报
回复
delete table2 where s1 in (select s1 from table1)

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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