作者rogertu (Innocent World)
看板Database
标题Re: [SQL ] MySQL Update指令的问题 (self)
时间Wed Apr 28 14:57:52 2010
※ 引述《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
: 请问这有什麽方法可以解决的吗??
没测试过,不过是否可以使用别名?
例如 update M set A=0 where B in (select m1.D from M as m1 where m1.C=0)
之类的...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.168.202.152
※ 编辑: rogertu 来自: 118.168.202.152 (04/28 14:58)