这个查询错在什么地方,请大家帮我看一下?

diaorenhong 2001-09-27 01:02:08
我想删除表A中的所有纪录中的字段dwdm等于111111的纪录,我写的语句在下面,但是运行时出现这种情况:
语句如下:
delete 表A
where dwdm in ( 111111)

错误提示:
[SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
请问一下,该如何解决这个问题
...全文
142 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
wanghai 2001-09-27
  • 打赏
  • 举报
回复
delete from tableA where dwdm = '111111'没有理由不行的呀,就算有重复值也不要紧呀
diaorenhong 2001-09-27
  • 打赏
  • 举报
回复
单位代码可以是相同的,但是其他的子段的值不同
icevi 2001-09-27
  • 打赏
  • 举报
回复
我试了一下是好的呀
LUJUN 2001-09-27
  • 打赏
  • 举报
回复
可能有重复的记录,建一主键索引试试!
ufo_ufo 2001-09-27
  • 打赏
  • 举报
回复
你的表结构是怎样的??
diaorenhong 2001-09-27
  • 打赏
  • 举报
回复
请大家帮我在想一想,谢谢哦
diaorenhong 2001-09-27
  • 打赏
  • 举报
回复
我试了一下,delete from pr_cbzh where dwdm in ('1111111111')
还是相同的错误,
diaorenhong 2001-09-27
  • 打赏
  • 举报
回复
字段类型为char,如果用
delete 表A
where dwdm = 111111
就会出现
[SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
的错误,这个问题怎样解决
KingSunSha 2001-09-27
  • 打赏
  • 举报
回复
delete from tableA where dwdm = '111111';
or
delete from tableA where dwdm in ('111111');
ePing 2001-09-27
  • 打赏
  • 举报
回复
同意楼上的
wireman 2001-09-27
  • 打赏
  • 举报
回复
字段類型對不對?number or char?
haihong 2001-09-27
  • 打赏
  • 举报
回复
delete 表A
where dwdm = 111111 不行吗?

咚咚咚咚咚咚 2001-09-27
  • 打赏
  • 举报
回复
应该使用游标的办法删除吧

34,871

社区成员

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

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