Unwanted repeated adding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a small table that has been imported from an ExCel file containing
some instrument info. The fields are:

Denomination
Type
Notes
ManufacturerID (foreign key)
PriceGroup (foreign key)

I want to import this small table to the main instrument table. The main
table has the same fields with the addition of a counter. I made an "adding
query" (i don't know the real english name as i'm using a non-english version
of Access, but I hope you know what I mean) to make the import, and it works
ok - except for the fact that it's importing the data five times. Why would
it do that?

Thanks!
 
Append Query - Adds data to a table.

If you run the Append Query 5 times, it would do this.

Post your SQL.
 
Hi!
This is the sql code:

INSERT INTO ExTestInstTbl ( InstDenomination, InstType, InstNotes,
ManufacturerID, Pricegroup )
SELECT ExTestTbl.Denomination, ExTestTbl.Type, ExTestTbl.Note,
ExTestTbl.ManufacturerID, ExTestTbl.PriceGroup
FROM ExTestInstTbl, ExTestTbl;

Where ExTestInstTbl is the main table an ExTestTbl is the temporary table.
Like I said it works exactly like it's suposed to except that instead of
adding the 38 rows that's in the ExTestTbl is will add 190 rows (running it
just once)..
 
Dear Az:

For now, all we need focus on is the SELECT portion of the query:

Let's see, 38 * 5 = 190. So, there must be 5 rows in the ExTestInstTbl.
You see, when you list two different tables in the FROM clause, you get one
row for every COMBINATION of rows in each table.

However, none of the columns you SELECT is from the ExTestInstTbl. So why
is it included. If you drop it, you'll have just the 38 rows. At least,
that looks like it's your problem. Change the FROM clause to:

FROM ExTestTbl;

Tom Ellison
 

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

Back
Top