當前位置:外匯行情大全網 - 外匯匯率 - qw123

qw123

create table a

(

id int primary key not null identity(1,1),

name varchar(20) unique,

pwd varchar(30)

)

create table b

(

id int primary key not null identity(1,1),

name varchar(20) unique,

info varchar(30)

)

insert into a values ('qw','123')

insert into b values ('qw',Null)

select * from a

select * from b

1 qw 123

1 qw NULL

sql替換:

根據妳的要求,不應該用insert

而是要用update

代碼如下:

update b set info =(select pwd from a,b where a.name=b.name)

(1 行受影響)

select * from a

select * from b

結果預期!

呵呵

其他寫法:

update b set info =(select pwd from a join b on a.name=b.name)

***同學習!

  • 上一篇:鬥魚id有空白代碼嗎
  • 下一篇:歐派克會議是什麽意思
  • copyright 2024外匯行情大全網