Transpose JOINED tables to one table

I need to transpose the data from a couple tables (tblOrgHours,tblOrgActivities) to one of the other existing tables (tblOrgEvents.  I have events that are in tblOrgHours innerjoin tblOrgActivities that can be located using the following SQL Query.

select * from tblOrgHours H innerjoin tblOrgActivities A on H.ActivityID = A.ActivityID where H.Unregistered > 0

Open in new window

I need the following columns of this recordset to be inserted into tblOrgEvents:

H.Agency, H.ActivityDate, H.Classification,H.BasedOn, H.HourTimeFrom, H.HourTimeTo, H.Hours, H.Duration, H.Frequency, H.ActivityType, H.ActivityOther, H.Objectives, H.Strategy, H.Need, H.NeedOther, H.Outcome, A.ActivityName, H.Narrative, H.EntryTime, H.Fiscal, H.Unregistered

Some column names are different in the destination table.  Please note below:
(H.ActivityDate(tblOrgHours) corresponds to EventDate(tblOrgEvents)
H.Narrative(tblOrgHours) corresponds to Comments(tblOrgEvents)
H.Unregistered(tblOrgHours) corresponds to  TotalParticipants(tblOrgEvents)
A.ActivityName(tblOrgActivities) corresponds to Activity(tblOrgEvents)

Thank you for your help!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russell FoxDatabase DeveloperCommented:
I didn't list every field, but this is the basic query you would use:
INSERT INTO tblOrgEvents (
	TotalParticipants ,
SELECT h.ActivityDate,
FROM tblOrgHours H 
	INNER JOIN tblOrgActivities A 
		ON H.ActivityID = A.ActivityID 
WHERE H.Unregistered > 0

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.