Posted By: kavos (Je to fajn, mit proc zit) on 'CZdatabases'
Title:     Re: update v SQL serveru
Date:      Sat Aug 30 15:30:26 2003

Co treba takhle:

create table table1 (id int, a int, b int, c int)
create table table2 (id int, aa int, bb int, cc int)

insert into table1 values(1, 11, 12, 13)
insert into table1 values(2, 21, 22, 23)
insert into table1 values(3, 31, 32, 33)

insert into table2 values(1, 111, 112, 113)

update table1 
set a = aa, b = bb, c = cc
from table2
where table1.id = table2.id

select * from table1

posledni select vraci:

1 111 112 113
2  21  22  23
3  31  32  33

kavos

> HI,
> nevite jak updateovat vic sloupcu najednou ?
> vim jak v oracel ...
> 
> update xxx set (a,b,c)=(select a,b,c from BBB where xxx.id = bbb.id)
> 
> 
> Dik
> 
> 
> T.

Search the boards