记录删除(简单问题,先解决者有分)

xyz_no1 2001-08-20 09:45:37
有两个表table1,table2,他们有相同的两个字段field1,field2
现在要从table1中删除这样的记录:该记录字段field1,field2的值
对应于table2中的某记录(即table1.field1=table2.field1 and table1.field2=table2.field2)
请大家帮忙
...全文
103 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
yqh 2001-08-21
  • 打赏
  • 举报
回复
delete from (select * from table1 a,table2 b where a.field1=b.field1 and a.field2=b.field2)
MountLion 2001-08-21
  • 打赏
  • 举报
回复
delete from table1 a
where exists(select * from table2 b where a.field1=b.field1 and a.field2=b.field2)
xyz_no1 2001-08-21
  • 打赏
  • 举报
回复
知道的话,请帮忙
xyz_no1 2001-08-21
  • 打赏
  • 举报
回复
这样写的话,认不到table2.field1,table2.field2
windindance 2001-08-21
  • 打赏
  • 举报
回复
delete table1 where table1.field1=table2.field1 and table1.field2=table2.field2
suary 2001-08-21
  • 打赏
  • 举报
回复
如果是用SQL SERVER 数据库可写触发器
xyz_no1 2001-08-21
  • 打赏
  • 举报
回复
MountLion(人不寐)的方法正确
tikkypeng 2001-08-21
  • 打赏
  • 举报
回复
delete table1 where table1.field1=table2.field1 and table1.field2=table2.field2
zgamer 2001-08-20
  • 打赏
  • 举报
回复
在select语句中可以用的条件,在delete中不是可以照样用吗

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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