Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which query Update or Append? And How to write it

Status
Not open for further replies.

Zonie32

Technical User
Jan 13, 2004
242
US
I have 2 tables. TblMaster and TblPlan. Each has a common field called CaseNumber.

In TblMaster there is a field labeled PlanName which is blank. In TblPlan there is that same field which is properly filled in with the PlanName.

Now, how do I get the PlanName from TblPlan to insert correctly into TblMaster based on the CaseNumber? Can anyone suggest the best way to do this?
 
By first removing the PlanName field from tblMaster to avoid duplication.
Then you get the PlanName by joining tblMaster and tblPlan on the CaseNumber field which should be the PrimaryKey (or at least an unique index) in tblPlan.
The SQL code may be something like this:
SELECT M.field1, M.CaseNumber, P.PlanName, P.fieldX
FROM tblMaster M INNER JOIN tblPlan P ON M.CaseNumber=P.CaseNumber;
You may take a look here:

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top