没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
1页
比如: UPDATE test.tb_vobile a set a.name = '111 ' WHERE a.id = (select max(id) id from test.tb_vobile) 报错: [SQL]UPDATE test.tb_vobile a set a.name = '111 ' WHERE a.id = (select max(id) id from test.tb_vobile) 以下可通过: UPDATE test.tb_vobile a join (select max(id) id
资源推荐
资源详情
资源评论
MySQL数据库数据库update更新子查询更新子查询
比如:
UPDATE test.tb_vobile a
set a.name = '111 '
WHERE
a.id = (select max(id) id from test.tb_vobile)
报错:
[SQL]UPDATE test.tb_vobile a
set a.name = '111 '
WHERE
a.id = (select max(id) id from test.tb_vobile)
以下可通过:
UPDATE test.tb_vobile a
join
(select max(id) id from test.tb_vobile) b
on a.id = b.id
set a.name = '123 ';
或
UPDATE test.tb_vobile a ,(select max(id) id from test.tb_vobile) b
set a.name = '321 '
WHERE
a.id = b.id ;
说明:
1、update 时,更新的表不能在set和where中用于子查询;
2、update 时,可以对多个表进行更新(sqlserver不行);
如:update ta a,tb b set a.Bid=b.id ,b.Aid=a.id;
3、update 后面可以做任意的查询,这个作用等同于from;
UPDATE test.tb_vobile a
set a.name = '111 '
WHERE
a.id = (select max(id) id from test.tb_vobile)
报错:
[SQL]UPDATE test.tb_vobile a
set a.name = '111 '
WHERE
a.id = (select max(id) id from test.tb_vobile)
[Err] 1093 – You can't specify target table 'a' for update in FROM clause
以下可通过:
UPDATE test.tb_vobile a
join
(select max(id) id from test.tb_vobile) b
on a.id = b.id
set a.name = '123 ';
或
UPDATE test.tb_vobile a ,(select max(id) id from test.tb_vobile) b
set a.name = '321 '
WHERE
a.id = b.id ;
说明:
1、update 时,更新的表不能在set和where中用于子查询;
2、update 时,可以对多个表进行更新(sqlserver不行);
如:update ta a,tb b set a.Bid=b.id ,b.Aid=a.id;
3、update 后面可以做任意的查询,这个作用等同于from;
weixin_38648309
- 粉丝: 5
- 资源: 902
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Matlab人脸肤色定理的教师人数统计+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于Matlab霍夫曼变换的表盘读数识别+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于Matlab火灾烟雾检测源码带GUI界面+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于Matlab的恶劣天气交通标志识别系统+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于MATLAB的霍夫曼变换的表盘示数识别+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于Matlab的车道线识别系统 +源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于MATLAB的教室人数统计系统带Gui界面+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于MATLAB的教室人数统计系统带Gui界面+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于MATLAB 的霍夫曼变换答题卡识别源码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
- 基于Matlab+bp神经网络的神经网络汉字识别系统+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页