是这样的吗:
update batchinfo set instrument='Instrument 17' where
datapath like '%10497%' or
datapath like '%10506%' or
datapath like '%10516%' or
datapath like '%11081%'
and instrument='Instrument 1'如下所示:
update batchinfo set instrument='Instrument 17' where
datapath like '%10497%' and instrument='Instrument 1' or
datapath like '%10506%' and instrument='Instrument 1' or
datapath like '%10516%' and instrument='Instrument 1' or
datapath like '%11081%' and instrument='Instrument 1'发布于 2010-08-12 00:49:33
否- AND仅限定datapath like '%11081%'。
不要冒险--使用括号。它们更便宜。
发布于 2010-08-12 00:49:52
不是,但这两个是等价的:
update batchinfo
set instrument='Instrument 17'
where
(datapath like '%10497%' or
datapath like '%10506%' or
datapath like '%10516%' or
datapath like '%11081%')
and instrument='Instrument 1' 和
update batchinfo
set instrument='Instrument 17'
where
(datapath like '%10497%' and instrument='Instrument 1') or
(datapath like '%10506%' and instrument='Instrument 1') or
(datapath like '%10516%' and instrument='Instrument 1') or
(datapath like '%11081%' and instrument='Instrument 1') 发布于 2010-08-12 00:50:11
不是的。请参阅mysql运算符precedence chart。通常,如果您混合使用AND和OR,在括号中抛出是个好主意。
https://stackoverflow.com/questions/3460737
复制相似问题