Updating a table from a child table

G

Guest

Hello,

I am not sure if this question was already posted and answered before (I
could not find it) but I want to know if it is possible to update a table
from a child table. I have designed a basic database to control air tickets.
There is a table Passenger and a table Ticket. In the table Ticket there is a
field to include the passenger and it was designed to look him/her up from
the table Passenger. What I try to intend is updating the table Passenger
from the table Ticket everytime I enter a new passenger without having to
update the table Passenger first.
I hope I can have a help from you.

Thank you.
 
D

Douglas J. Steele

Sorry, you have to make two separate updates (and, assuming you've got
referential integrity set, they have to be done in the correct order)

Presumably you're using a form for the updates, so shouldn't be particularly
difficult to do. If you're trying to update the tables directly, stop it!
Tables are seldom* appropriate for manual intervention.

* Most people would probably say "never", rather than "seldom"
 
J

Jamie Collins

you have to make two separate updates (and, assuming you've got
referential integrity set, they have to be done in the correct order)

I don't understand you comment about 'correct order'. If there is
referential integrity then notionally the data in both tables is the
same; in some SQL products (but not Access.Jet) the data is physically
the same. Therefore, you cannot change one without changing the other
and they must be changed as one atomic action; there is no implied
order. If a CASCADE action exists, the data (notionally) in the
referenced table must be changed.

Jamie.

--
 
D

Douglas J. Steele

Jamie Collins said:
I don't understand you comment about 'correct order'.


I simply meant that the data had to be inserted into the parent table before
the data could be inserted into the child table.
 
J

Jamie Collins

Douglas said:
I simply meant that the data had to be inserted into the parent table before
the data could be inserted into the child table.

Yours is the first time "inserted" has been used in this thread.

"Update", " updating", " updates": you can see why I would think the OP
and yourself were both referring to an UPDATE action!

Jamie.

--
 

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