分享

update .... set xxx = (select xx from ....)

 老年图书馆 2012-03-05

呵呵,搞了半天,原来我看错了你的第二种情况的意思。以为是返回字段的值为null时不update.
如果是这样,好象case都不需要了。
Update table_a set a_field_1 = (select b_field_1 from table_b where table_a.a_field_2 = table_b.b_field_2)
--下面条件用于限制update范围
where exists(select 1 from table_b where table_a.a_field_2 = table_b.b_field_2 and table_b.b_field1<>特定值)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多