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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query with null values

Status
Not open for further replies.

qster

ISP
Mar 11, 2002
55
CA
Hi,

I need some help trying to figure this out. I have 2 Tables, table_A has the data for a database and table_B has updates to be updated into table_A and has all the same columns.

The problem I am running into is when I do the update(s) from table_B to table_A and there are blank cells in table_B it is taking the blanks into table_A.
I have tried using the criteria to exclude null values, but then it does not update table_A properly if other cells have a value.

I am using:
UPDATE TableB LEFT JOIN TableA ON TableB.[Employee ID] = TableA.[Employee ID] SET TableA.[Revision Date] = [TableB.Revision Date], TableA.SBU = [TableB.SBU], TableA.[Reporting Status] = [TableB.Reporting Status]
WHERE (((TableA.[Revision Date])=[TableA.Revision Date]) AND ((TableA.SBU)=[TableA.SBU]) AND ((TableA.[Reporting Status])=[TableA.Reporting Status]));

Any help would greatly be appreciated,
Q
 
Does the Nz function work in this case? e.g

UPDATE TableB LEFT JOIN TableA ON TableB.[Employee ID] = TableA.[Employee ID] SET TableA.[Revision Date]
= Nz([TableB.Revision Date], TableA.[Revision Date])...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top