有一视图v_ware(wareid counter busno name unit)
busno counter wareid name unit
01 A54 02135 百合 克
01 null 05166 黄芪 克
01 NULL 05566 百合 克
01 A54 05421 百合 克
..............
视图中有counter为NULL值 的,例如百合 有同名,且 wareid=02135 的counter是
有值的,那么wareid=05566 的NULL值要求修改为等于 wareid 02135的counter值A54
名称为黄芪的counter值尽管为NULL但是没有同名字的则不需要改变
SQL更新表,请大师指点!谢谢
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- 丶小飞哥 2016-07-28 06:30关注
/*从视图里面提取数据*/
select distinct counter,name into @counter,@name
from v_ware
where counter is not null and counter <> 'null'
limit 1;select @counter,@name;
/*更新数据*/
update ware set counter=@counter where name = @name;select * from ware;
解决 无用评论 打赏 举报
悬赏问题
- ¥15 c程序不知道为什么得不到结果
- ¥40 复杂的限制性的商函数处理
- ¥15 程序不包含适用于入口点的静态Main方法
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置