mysql update不能直接使用select的结果
在sql server中,我们可是使用以下update语句对表进行更新:
update a set a.xx= (select yy from b) ;
但是在mysql中,不能直接使用set select的结果,必须使用inner join:
update a inner join (select yy from b) c set a.xx = c.yy
自行示例:


mysql update不能直接使用select的结果的更多相关文章
- mysql: update字段中带select
update字段中带select UPDATE tb_report_type A INNER JOIN (SELECT LEVEL_CODE FROM tb_report_type WHERE id ...
- Mysql update语句赋值嵌套与在表列中数据后面增加数据
1.Mysql update语句赋值嵌套select 点击(此处)折叠或打开 update a set col=(select col from a where id='5') where id&g ...
- mysql update select 用法
之前用SqlServer , update语句对表进行更新:update a set a.xx= (select yy from b) ; 是可以的但是在mysql中,不能直接使用set select ...
- MySql Update Select 嵌套
UPDATE `TB_CM_Dic` SET `ParentID` = (SELECT `ID` FROM (SELECT * FROM `TB_CM_Dic`) AS B WHERE `DicNam ...
- MySQL update select组合
update t_news inner join (select readCount from t_news t2 where t2.id=1) t1 set t_news.readCount = t ...
- mysql update操作
update语法 Single-table语法: UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1 [, col_name2=ex ...
- mysql update语句
UPDATE ClientBankInfo SET status = 3 WHERE sn IN (SELECT sn FROM zjzc.ClientBankInfo WHERE cardNo IN ...
- Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause
Mysql update in报错 解决方案: [Err] 1093 - You can't specify target table 'company_info' for update in FRO ...
- mysql update 忘加 where 文件恢复
前提条件:mysql :data_row_format=rowmysql> show variables like '%image%';+------------------+-------+| ...
随机推荐
- c语言结构体中的冒号的用法
结构体中常见的冒号的用法是表示位域. 有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位.例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可.为了节省 ...
- PHP中使用函数array_merge()合并数组
如果明白数组其实就是map的话,我想你就会明白array_merge为什么要这么实现了 PHP中合并数组分成两种情况 1.如果这两个数组中有相同的字符串键名: <?php header('Con ...
- Lesson: Introduction to JAXP
The Java API for XML Processing (JAXP) is for processing XML data using applications written in the ...
- uvaoj 10397 - Connect the Campus【最小生成树】
uvaoj 10397 - Connect the Campus Many new buildings are under construction on the campus of the Univ ...
- Result
1.常用四种类型: a) dispatcher(默认) 服务器跳转(普通转发),就是forward到一个JSP或者HTML或者其他结果页面,不能是Action 视图请求地址是 ...
- js两个时间比较
var applyStart = $("#ApplyStart").val().replace(/-/g,'/'); var applyEnd = $("#ApplyEn ...
- java 图片压缩 剪切 水印 转换 黑白 缩放
专注java已6年,欢迎加入java核心技术QQ群:135138817,每周五晚有群主进行技术讲座. import java.awt.AlphaComposite; import java.awt.C ...
- java获得项目绝对路径
在jsp和class文件中调用的相对路径不同. 在jsp里,根目录是WebRoot 在class文件中,根目录是WebRoot/WEB-INF/classes 当然你也可以用System.getPro ...
- PYTHON queue
http://blog.csdn.net/bravezhe/article/details/8588437
- 使用like时left outer join和inner join的区别
--select top 10000 * into #s from search set statistics time on set statistics io on select userId,c ...