Update a record from another table

eibooo

Registered User.
Local time
Today, 22:40
Joined
May 23, 2010
Messages
12
someone kindly help me on updating Table1 status with the last updated result of table2 status.

EG: there are many times we suspend each and every customers so i need to update status frequently therefore when i view a customer id in table1 the status should be = to the table2 status filed (last updated record)

TWO TABLE DETAILS ARE BELOW:

Table 1 (main table)
Fields
CID (customer ID- auto number)
name
status

table 2 (status updating table)
SID (Status ID - auto number)
CID (this field is link to CID in Table1)
status (active / suspended)
remarks
date

HOPE I HAVE EXPLAINED CLEARLY WHAT I NEED TO DO

THANK U IN ADVANCE
 
You are recording status twice. This is a breach of normalisation because the last record for a customer in the status table could be different from that recorded in the customer table.

You should only determine the current status for a customer by querying the record for that customer with Max date in the status table.
 
ok thanks for ur help
 

Users who are viewing this thread

Back
Top Bottom