SQL - update con un join

 
Vista:

update con un join

Publicado por Francisco (7 intervenciones) el 25/01/2007 16:13:16
Por favor me puede explicar alguien como hacer un update con un join de tablas?

Que debo tener encuenta?

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:update con un join

Publicado por Liliana (426 intervenciones) el 25/01/2007 16:48:02
Hola,
Un ejemplo muy simple:


create table #test1 (clave smallint, dato char(10))
insert #test1 select 1, 'dato1'

create table #test2 (clave smallint, dato char(10))
insert #test2 select 1,'dato2'

update #test1
set #test1.dato = #test2.dato
from #test1
inner join #test2 on #test1.clave = #test2.clave

select * from #test1
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar