作者evernever (!!M)
看板Database
标题Re: [SQL ] MySQL Update指令的问题 (self)
时间Wed Apr 28 17:48:29 2010
update M
set A=0
where B in
(select D from M where C=0)
改成
update M
set A=0
where B in
(SELECT * FROM (select D from M where C=0) M1)
※ 引述《tabear (胖熊)》之铭言:
: 我用的是MySQL
: 假设有一个table => M 里面有4个栏位 A, B ,C, D
: 所以我下面这个指令结果产生错误
: update M set A=0 where B in (select D from M where C=0)
: 回传讯息似乎是不能同table
: 所以我就复制一样的table => M1
: 执行:update M set A=0 where B in (select D from M1 where C=0) 这样就OK
: 请问这有什麽方法可以解决的吗??
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 115.64.54.125
1F:推 tabear:感恩 04/28 17:56