Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/08/2010, 14:26
odlarhg
 
Fecha de Ingreso: agosto-2010
Mensajes: 9
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: Como actualizo datos de una tabla a otra (detalle, encabezado)

Pues he recibido algunos consejos en otros foros y me enviaron esto.

with tlfs as
(
select
ID_cliente ,
ROW_NUMBER () over ( Partition by ID_cliente order by Telefono asc ) as RowNum ,
TELEFONO
from
TELEFONOS_ACT
)
update CLIENTES set
telefono1 =( select TELEFONO from tlfs where tlfs . id_cliente = CLIENTES . Id_cliente and rownum = 1 ),
telefono2 =( select TELEFONO from tlfs where tlfs . id_cliente = CLIENTES . Id_cliente and rownum = 2 ),
telefono3 =( select TELEFONO from tlfs where tlfs . id_cliente = CLIENTES . Id_cliente and rownum = 3 )

Aun no lo he probado, pero realmente se poco de T-SQL y estoy algo perdido

Tu que opinas?