Please help with Update Query

G

Guest

Hello Everyone,

I need help with the syntax of an update query. Source and Dest. tables
look like this:

tblDestination
IDX
EmplNum
ExpirationDate
StartDate
ARFDate
other columns

tblSource
EmplNum
StartDate
ARFDate

So, I need to select the EmplNum, StartDate, and ARFDate from the source
table and update every row in the Destination table WHERE Source.EmplNum =
Destination.EmplNum.

Can anyone help me out with this?

TIA,
Rich
 
G

Guest

Try this --
INSERT INTO tblDestination ( EmplNum, StartDate, ARFDate)
SELECT tblSource.EmplNum, tblSource.StartDate, tblSource.ARFDate
FROM tblSource
WHERE tblSource.EmplNum = tblDestination.EmplNum;
 
G

Guest

Hello Karl,

Thanks for the reply.

I however need an update query. I need to update 2 fields in the dest.
table. For that, do I need to run 2 update queries, 1 for each column?

What I need is:

Update tblDestination
Set emplStartDate =
Select emplStartDate
From tblSource
WHERE tblDest.EmplStartDate = tblSource.EmplStartDate

Then, another just like this only using ARFSubmitDate.

Thanks,
 
G

Guest

How about this ---
UPDATE tblSource INNER JOIN [tblDestination] ON tblSource.EmplNum =
tblDestination.EmplNum SET tblDestination.StartDate= tblSource.StartDate,
tblDestination.ARFDate=tblSource.ARFDate;
 

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