1.使用 sql 只查询一次 2.我自己的 sql: UPDATE guideline_news SET content = ( SELECT content FROM guideline_news WHERE id = 16 ) WHERE id > 16 备注: 这个 sql 报错:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT content FROM guideline_news WHERE id=16 WHERE id>16' at line 1
1
kokdemo 2016-12-28 14:59:14 +08:00
建议用一个临时变量先存一下 SELECT content FROM guideline_news WHERE id = 16
然后再更新 |
2
harborM 2016-12-28 17:06:37 +08:00
mysql 不能直接 set select ,需要使用 inner join
|
3
harborM 2016-12-28 17:08:52 +08:00
UPDATE guideline_news a inner join ( SELECT content FROM guideline_news WHERE id = 16 ) b SET a.content =b.content WHERE id > 16;试试这条语句;我在工作中也遇到过,百度就有解决方案: http://www.3lian.com/edu/2014/05-13/147149.html
|
4
q397064399 2016-12-28 17:10:05 +08:00
|