Append data to table

ComptechRx

Registered User.
Local time
Today, 15:27
Joined
Mar 14, 2011
Messages
13
Thank you in advance to all who can shed some light on this question.

I have a table called dbo.userinfo with a primary key called employeeid and a field named jobfunction.

i have an intermediate table named dbo.projectpositions with a primary key named projnumber and a foreign key named employeeid.

I have a 3rd table named projects with a primary key projnumber and a field called project manager.

I'm trying to append the Projects table so that any projects that a worker has worked on (dbo.projectpositions) that is listed as a project manager (jobfunction) will have their employeeid fill in the project manager field on the projects table. Looks something like this:

INSERT INTO Projects ( [Project Manager] )
SELECT dbo_UserInfo.JobFunction
FROM (dbo_UserInfo INNER JOIN dbo_ProjectPositions ON dbo_UserInfo.EmployeeID = dbo_ProjectPositions.EmployeeID) INNER JOIN Projects ON dbo_ProjectPositions.ProjNumber = Projects.ProjNumber
WHERE (((dbo_UserInfo.JobFunction)="Project Manager"));

But just can't figure out the next step to populate the project manager field...:banghead:
 
Last edited:
Um, run the query?

You might want to first create a test query to see just what information you are going to be putting in the added records.
 
lol I forgot to mention that when I run the Query, it doesn't actually do anything. It says a number of records will be affected but after clicking ok, nothing gets written.

After doing more searching it looks like an Update Query might be better since there are existing records? Right now I am using Append.
 

Users who are viewing this thread

Back
Top Bottom