日期:2014-05-17 浏览次数:20841 次
--try update p_data set abcclass=(select abcclass from p_data a where p_data.productcode=a.productcode and a.year=2012 and a.month=3) where p_data.year=2012 and p_data.month=7 and p_data.abcclass is null;
------解决方案--------------------
一楼正解
------解决方案--------------------
update p_data
set abcclass=(select abcclass from p_data a where p_data.productcode=a.productcode and a.year=2012 and a.month=3)
where p_data.year=2012 and p_data.month=7 and p_data.abcclass is null;
------解决方案--------------------
update p_data a
set abcclass=(select abcclass from p_data a where p_data.productcode=a.productcode and a.year=2012 and a.month=3) b
where a.year=2012 and a.month=7 and a.abcclass is null and a.id = b.id;
上面的ID都是你查询出来的同一条记录的值。