Add ONE record trought query

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

Guest

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
 
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.
 
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
 

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