
oracle 把表中姓名为张三的改为李四.姓名为张三的在表中有多个.怎么用一条sql写出来
不好意思上面搞错了.应该是性别是男的而且名字叫张三的改为李四,性别是女的而且名字叫李四的改为张三.字段id,name,sex...
不好意思上面搞错了.应该是性别是男的而且名字叫张三的改为李四,性别是女的而且名字叫李四的改为张三. 字段 id,name,sex
展开
6个回答
展开全部
使用case when then是可以的
update table set name = case when name='张三' and sex='男' then '李四' end,
case when name='李四' and sex='女' then '张三' end
update table set name = case when name='张三' and sex='男' then '李四' end,
case when name='李四' and sex='女' then '张三' end
展开全部
use TableName
update TableName set PersonName='李四' where PersonName=‘张三'
TableName 为你的表名
PersonName 为 TableName 表中 姓名字段
update TableName set PersonName='李四' where PersonName=‘张三'
TableName 为你的表名
PersonName 为 TableName 表中 姓名字段
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
update tablename set name='李四' where name=‘张三';
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
UPDATE TABLENAME SET FIELDNAME='李四' WHERE FIELDNAME='张三'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
update tab_name set name =
(case when sex='男' and name='张三' then '李四' when sex='女' and name='李四' then '张三' end)
没测试过,具体思路就是用case when
(case when sex='男' and name='张三' then '李四' when sex='女' and name='李四' then '张三' end)
没测试过,具体思路就是用case when
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
UPDATE TABLE
SET LAST_NAME ='李四‘
WHERE LAST_NAME=’张三‘;
SET LAST_NAME ='李四‘
WHERE LAST_NAME=’张三‘;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询