howto copy only newer OrderID data(and the other fields) from onetable to another table

B

Bartus

howto copy only newer OrderID data(and the other fields) from one
table to another table

So the new table is updated only with the new OrderID and the
OrderID's already copyied earlier are not also added everytime.

i use the append query i think and need certainly some criteria
(filters)?
Can somebody help me out, please?
Thank you!
Bart
 
D

Daryl S

Bartus -

The criteria you need (assuming OrderID is the key field) will be something
like this (use your table names):

= Not Exists (SELECT 'X' from [newTableName] where [newTableName].OrderID =
[oldTableName].OrderID)

If you still have problems, post your SQL so we can help more.
 
M

Marshall Barton

Bartus said:
howto copy only newer OrderID data(and the other fields) from one
table to another table

So the new table is updated only with the new OrderID and the
OrderID's already copyied earlier are not also added everytime.

i use the append query i think and need certainly some criteria
(filters)?


INSERT INTO table2 (OrderID, f1, f2, ...)
SELECT OrderID, f1, f2, ...
FROM table1 INNER JOIN table2
ON table1.key = table2.key
WHERE tabl2.key Is Null
 
B

Bart

INSERT INTO table2 (OrderID, f1, f2, ...)
SELECT OrderID, f1, f2, ...
FROM table1 INNER JOIN table2
        ON table1.key = table2.key
WHERE tabl2.key Is Null

INSERT INTO Bestellingen_copy (BestellingID)
SELECT BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null

I try your code and the system says BestellingID can point out more
then one source..
THe source and destination tables have no key(-ID).

Source table: Bestellingen_1
Dest. table: Bestellingen_copy

Can you help me out?

Thank you
Bart
 
D

Daryl S

Bart -

The tablename is needed on the SELECT line, like this:

INSERT INTO Bestellingen_copy (BestellingID)
SELECT Bestellingen_1.BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null
 
B

Bart

Bart -

The tablename is needed on the SELECT line, like this:

INSERT INTO Bestellingen_copy (BestellingID)
SELECT Bestellingen_1.BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
        ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null

--
Daryl S











- Tekst uit oorspronkelijk bericht weergeven -

Thank you Daryl,
why it doens't copy the data?

Bart
 
B

Bart

The tablename is needed on the SELECT line, like this:
INSERT INTO Bestellingen_copy (BestellingID)
SELECT Bestellingen_1.BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
        ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null
Bart said:
Bartus wrote:
howto copy only newer OrderID data(and the other fields) from one
table to another table
So the new table is updated only with the new OrderID and the
OrderID's already copyied earlier are not also added everytime.
i use the append query i think and need certainly some criteria
(filters)?
INSERT INTO table2 (OrderID, f1, f2, ...)
SELECT OrderID, f1, f2, ...
FROM table1 INNER JOIN table2
        ON table1.key = table2.key
WHERE tabl2.key Is Null
--
Marsh
MVP [MS Access]
INSERT INTO Bestellingen_copy (BestellingID)
SELECT BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
        ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null
I try your code and the system says BestellingID can point out more
then one source..
THe source and destination tables have no key(-ID).
Source table: Bestellingen_1
Dest. table: Bestellingen_copy
Can you help me out?
Thank you
Bart
.- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -

Thank you Daryl,
why it doens't copy the data?

Bart- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

=not Exists (SELECT 'KlantID' from [Klant_copy] where
[Klant_copy].KlantID =
[Klant].KlantID)

I try this also, but i does'nt transfer anything
Bart
 
B

Bart

Bart -
The tablename is needed on the SELECT line, like this:
INSERT INTO Bestellingen_copy (BestellingID)
SELECT Bestellingen_1.BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
        ON Bestellingen_1.BestellingID= Bestellingen_copy.BestellingID
WHERE Bestellingen_copy.BestellingID Is Null
--
Daryl S
:
Bartus wrote:
howto copy only newer OrderID data(and the other fields) from one
table to another table
So the new table is updated only with the new OrderID and the
OrderID's already copyied earlier are not also added everytime.
i use the append query i think and need certainly some criteria
(filters)?
INSERT INTO table2 (OrderID, f1, f2, ...)
SELECT OrderID, f1, f2, ...
FROM table1 INNER JOIN table2
        ON table1.key = table2.key
WHERE tabl2.key Is Null
--
Marsh
MVP [MS Access]
INSERT INTO Bestellingen_copy (BestellingID)
SELECT BestellingID
FROM Bestellingen_1 INNER JOIN Bestellingen_copy
        ON Bestellingen_1.BestellingID= Bestellingen_copy..BestellingID
WHERE Bestellingen_copy.BestellingID Is Null
I try your code and the system says BestellingID can point out more
then one source..
THe source and destination tables have no key(-ID).
Source table: Bestellingen_1
Dest. table: Bestellingen_copy
Can you help me out?
Thank you
Bart
.- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
Thank you Daryl,
why it doens't copy the data?
Bart- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -

=not Exists (SELECT 'KlantID' from [Klant_copy] where
[Klant_copy].KlantID =
[Klant].KlantID)

I try this also, but i does'nt transfer anything
Bart- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

i found it!

SELECT Klant.KlantID, Klant.Instellingsnaam, Klant.Naam,
Klant.Voornaam, Klant.EmailAdres, Klant.Directe_telefoon,
Klant.KlantRootID, Klant.Memo, Klant.SoortKlant, Klant.Straatnaam_nr,
Klant.Gemeente, Klant.Postcode, Klant.Passwoord
FROM Klant LEFT JOIN Klant_copy ON Klant.KlantID = Klant_copy.KlantID
WHERE (((Klant_copy.KlantID) Is Null));

INSERT INTO Klant_copy
SELECT Query98.*
FROM Query98;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top