本帖最后由 jin2106 于 2012-11-03 19:19:55 编辑

解决方案 »

  1.   

    Update dwu_bqf_item_day a
             Set a.lastyear_value = (select b.lastyearvalue
                                       from bq_data_lastyear b
                                      where a.corp_code = b.corp_code
                                        and a.item_code = b.item_code and rownum=1)
           Where exists (select 1
                    from bq_data_lastyear b
                   where a.corp_code = b.corp_code
                     and a.item_code = b.item_code) 
      

  2.   

    你的这个子查询返回多行结果
    select b.lastyearvalue
    from bq_data_lastyear b
    where a.corp_code = b.corp_code
    and a.item_code = b.item_code可以是有聚合函数,比如max() min() ……
    也可以像一楼一样
      

  3.   

    加rownum=1就行,只要你确定返回的多行都是相同值