同一张表2个字段匹配

jollroy 2014-11-12 11:09:39
我有张表cu 字段 ID ,phone, number
如果phone为空的话,就把number的赋值给phone
...全文
576 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
select id, nvl(phone,number) as phone from cu;
aoxuelingshuang 2015-01-27
  • 打赏
  • 举报
回复
update cu set phone=number where phone is null is null用来判断是否为空,为空则执行update操作
aoxuelingshuang 2015-01-27
  • 打赏
  • 举报
回复
update cu set phone=number where phone is null
rick-he 2015-01-26
  • 打赏
  • 举报
回复
引用 8 楼 pobaby 的回复:
update cu set phone=decode(phone,null,number,phone);
简练啊
lyangsoft 2015-01-26
  • 打赏
  • 举报
回复
引用 楼主 jollroy 的回复:
我有张表cu 字段 ID ,phone, number 如果phone为空的话,就把number的赋值给phone
正解
不写代码的钦 2015-01-26
  • 打赏
  • 举报
回复
pobaby 2015-01-24
  • 打赏
  • 举报
回复
update cu set phone=decode(phone,null,number,phone);
绕天涯_2014 2015-01-23
  • 打赏
  • 举报
回复
select ID ,nvl(phone,number), number from cu
ffshao 2014-11-19
  • 打赏
  • 举报
回复
给点活路啊,都回答完了,没得说了。
bw555 2014-11-13
  • 打赏
  • 举报
回复
引用 1 楼 zlloct 的回复:
[quote=引用 楼主 jollroy 的回复:] 我有张表cu 字段 ID ,phone, number 如果phone为空的话,就把number的赋值给phone
update cu set phone=number where phone is null[/quote] 正解,最近的问题怎么都这么……
taste品味 2014-11-13
  • 打赏
  • 举报
回复
这么简单的问题
L-B-J 2014-11-13
  • 打赏
  • 举报
回复
靠 ,我还没来的及发表呢,就被你们回答了
CT_LXL 2014-11-12
  • 打赏
  • 举报
回复
引用 楼主 jollroy 的回复:
我有张表cu 字段 ID ,phone, number 如果phone为空的话,就把number的赋值给phone
update cu set phone=number where phone is null

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧