Tema: Anexar datos
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/11/2010, 06:31
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: Anexar datos

Fijate bien:


INSERT INTO [General_agosto]
....
SELECT ...
FROM
General_Octubre
Where [General_agosto].[ No_Identificacion] NOT IN (Select General_Octubre.No_Identificacion From General_Octubre)

Eso intenta insertar a General_agosto cosas de Octubre que no tengan el identificador en Octubre...

A ver asi

Código SQL:
Ver original
  1. INSERT INTO [General_agosto]
  2.                 (Departamento,  
  3.                 Municipio,
  4.                 Folio,
  5.                 Nombres,
  6.                 No_Identific acion,
  7.                 dir,
  8.                 Tel,
  9.                 cel,
  10.                 origen,
  11.                 barrio,
  12.                 sector,
  13.                 cohorte,
  14.                 estado,
  15.                 CGS)
  16.       SELECT Departamento,  
  17.                    Municipio,
  18.                    Folio,
  19.                    Nombres,
  20.                    No_Identific acion,
  21.                    dir,
  22.                    Tel,
  23.                    cel,
  24.                    origen,
  25.                    barrio,
  26.                    sector,
  27.                    cohorte,
  28.                    est ado,
  29.                    CGS
  30.              FROM General_Octubre
  31.              WHERE No_Identificacion NOT IN
  32.                            (SELECT No_Identificacion
  33.                                        FROM General_Agosto)


Es decir inserta los de Octubre que no esten en Agosto.

Quim