Hilton,

Actually, you can accomplish the whole package in one SQL UPDATE 
statement.  Something along the lines of
UPDATE Patient_History
SET Drug_Name
{place you select query here};

Essentially it needs to have the following basic format:
UPDATE Patient_History
SET colx =
(
SELECT Drugs.Name AS Drug_Name
FROM Drugs
WHERE Drugs.DrugID=Patient_History.DrugID
)

On the other hand, you can accomplish the same thing with a join to 
the Drug table when you need it and you don't consume the extra space 
in the database for all those duplicated drug names.

At 04:36 PM 10/18/2006, you wrote:
>Hi all
>
>I am new to the list and have a slight problem which I hope you experts can
>solve. I am a pharmacist doing a project. I have three tables
>1. A patient table with the patient details
>2. A Pharmaceutical drug table with drug names and dosage and other data.
>3. A Patient history record with the drug names and dosages.
>
>The patient and history table are linked by a master-detail relationship. I
>have set up a search on the drug table to look up the drug names etc, but
>after I have found the drug how do I insert the values of the name and
>dosage into the patient history table.
>
>
>I hope some one can help.
>
>Many Thanks
>
>Hilton Gowar
>
>__________________________________________________
>Delphi-Talk mailing list -> Delphi-Talk@elists.org
>http://www.elists.org/mailman/listinfo/delphi-talk

__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to