日期:2014-05-18 浏览次数:20671 次
create table t(fbillno varchar(10),fentryid_src int,fitemid int) insert into t select '00000029',1,1907 insert into t select '00000036',1,1893 insert into t select '00000037',2,1905 insert into t select '00000038',3,1907 insert into t select '00000039',4,1909 insert into t select '00000040',5,1911 insert into t select '00000041',6,1915 insert into t select '00000042',1,1919 create table seorderentry(fentryid int,fitemid int,FEntrySelfS0168 int) insert into seorderentry select 1,1907,null insert into seorderentry select 1,1893,null insert into seorderentry select 2,1905,null insert into seorderentry select 3,1907,null insert into seorderentry select 4,1909,null insert into seorderentry select 5,1911,null insert into seorderentry select 6,1915,null insert into seorderentry select 1,1919,99990 go update mm set FEntrySelfS0168= b.fbillno from seorderentry mm inner join (select * from t) b --用这个查询结果代替你的查询语句 on mm.fentryid = b.fentryid_src and mm.fitemid = b.fitemid select * from seorderentry /* fentryid fitemid FEntrySelfS0168 ----------- ----------- --------------- 1 1907 29 1 1893 36 2 1905 37 3 1907 38 4 1909 39 5 1911 40 6 1915 41 1 1919 42 (8 行受影响) */ go drop table t,seorderentry