Add ONE record trought query

A

an

Hi!

I would like add only last record added. For this I used:

INSERT INTO T_1 ( IdName, Name )
SELECT T_1.IdName, T_1.Name
FROM T_1;

When run this append query, it "offer" to add all records.
How is possible add only new record, please.
Thanks in advance.
an
 
J

Jerry Whittle

In the SELECT part of the append query, you must return only the one record
which you want inserted into the table. Work on it until you get that part
right. Also the concept of "Last" is meaningless in a relational database.
You'll need something like a date/time field to show the last record. If you
have an autonumber field in the table, it MIGHT increment properly and you
can get the largest number from it; however, Autonumbers are not guaranteed
to be sequential.

Also if either ID_Name or Name is a unique constraint or primary key, it
will not insert. You could even have trouble if either of these fields are
part of a primary key or unique constraint.
 
A

an

JW, thanks for your reply.

Sorry for my ignorance, but:
"In the SELECT part of the append query, you must return only the one record
which you want inserted into the table."

How, please?
an
 
Top