小弟初学数据库,请各位大哥大姐帮帮~~~
求SQL语句,数据库为MS Server 2000
有2个表 :table1 table2
table1 table2
id number1 price .. id number2 name...
01 2 5 01 0 A
02 3 2 02 4 B
03 6 3 03 1 C
04 6 12 04 0 Did 为主键
现在想要把 table1 的列number1的数 按字段 id复制到 table2 的number2,直接覆盖number2的值,而且 table2的其他列不能变
即 我要的结果为
table2
id number2 name
01 2 A
02 3 B
03 6 C
04 6 D
求SQL语句,数据库为MS Server 2000
有2个表 :table1 table2
table1 table2
id number1 price .. id number2 name...
01 2 5 01 0 A
02 3 2 02 4 B
03 6 3 03 1 C
04 6 12 04 0 Did 为主键
现在想要把 table1 的列number1的数 按字段 id复制到 table2 的number2,直接覆盖number2的值,而且 table2的其他列不能变
即 我要的结果为
table2
id number2 name
01 2 A
02 3 B
03 6 C
04 6 D
where a.id=b.id
set
number2=t1.number1
from
table1 t1,
table2 t2,
where
t1.id=t2.id;