Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Tablas planas (https://www.clubdelphi.com/foros/forumdisplay.php?f=20)
-   -   Ayuda con un Query en access (https://www.clubdelphi.com/foros/showthread.php?t=55184)

richy08 09-04-2008 23:14:46

Ayuda con un Query en access
 
este es mi query

INSERT INTO MASTER ( MODELO, MARCA, DESCRIPCION, Precio, [PRECIO PUBLICO], Type, [Size], supplier, erate )
SELECT MASTER1.MODELO, MASTER1.MARCA, MASTER1.DESCRIPCION, MASTER1.Precio, MASTER1.[PRECIO PUBLICO], MASTER1.Type, MASTER1.Size, MASTER1.supplier, MASTER1.erate
FROM MASTER1;

pero no se como indicarle que solo me inserte los registros que estan en MASTER1 y no aparecen en MASTER, las tablas son identicas y la clave primaria es MODELO, el not in no funciona alguie nsabe por que muchas gracias:confused:

poliburro 09-04-2008 23:26:43

Código SQL [-]
 
INSERT 
   INTO MASTER 
          ( MODELO, MARCA, DESCRIPCION, Precio, [PRECIO PUBLICO], Type, 
           [Size], supplier, erate )
 
           SELECT MASTER1.MODELO, MASTER1.MARCA,     
                      MASTER1.DESCRIPCION, MASTER1.Precio, MASTER1.[PRECIO 
                      PUBLICO], MASTER1.Type, MASTER1.Size, 
                      MASTER1.supplier,  MASTER1.erate
              FROM MASTER1
            Inner Join MASTER 
                       On Master1.Modelo <> Master.Modelo

richy08 09-04-2008 23:37:19

Gracias Poliburro pero ya lo intente como lo pusiste y no funciona me duplical os registros

poliburro 09-04-2008 23:42:00

Me podrías indicar que campo o campos forman tu llave primaria?

richy08 09-04-2008 23:43:51

Sip Claro MODELO es la llave primaria de las dos Tablas

richy08 10-04-2008 00:35:57

Bueno aqui les dejo la solucion para que en u nfuturo a laguien le sirva :D

Código SQL [-]
 
INSERT INTO MASTER ( MODELO, MARCA, DESCRIPCION, Precio, [PRECIO PUBLICO], Type, [Size], supplier, erate )
SELECT MASTER1.MODELO, MASTER1.MARCA, MASTER1.DESCRIPCION, MASTER1.Precio, MASTER1.[PRECIO PUBLICO], MASTER1.Type, MASTER1.Size, MASTER1.supplier, MASTER1.erate
FROM MASTER1 LEFT JOIN MASTER ON MASTER1.[MODELO] = MASTER.[MODELO]
WHERE (((MASTER.MODELO) Is Null));

:DSe me esta hacend costumbre responderme solo jaja:D

richy08 10-04-2008 00:36:31

Bueno aqui les dejo la solucion para que en u nfuturo a laguien le sirva :D


Código SQL [-]

INSERT INTO MASTER ( MODELO, MARCA, DESCRIPCION, Precio, [PRECIO PUBLICO], Type, [Size], supplier, erate )
SELECT MASTER1.MODELO, MASTER1.MARCA, MASTER1.DESCRIPCION, MASTER1.Precio, MASTER1.[PRECIO PUBLICO], MASTER1.Type, MASTER1.Size, MASTER1.supplier, MASTER1.erate
FROM MASTER1 LEFT JOIN MASTER ON MASTER1.[MODELO] = MASTER.[MODELO]
WHERE (((MASTER.MODELO) Is Null));







:DSe me esta haciendo costumbre responderme solo jaja:D perdon creo que lo envie dos veces y n otiene boton de borrar:o


La franja horaria es GMT +2. Ahora son las 18:43:46.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi