M
Maarkr
What I have: Three tables for a many:many. Roster with ID, LFName... TngPer
with PerID, PerName (four training periods per month for the next 4 years,
named like Apr2010A, Apr2010B...)... and a TngJct with JctID, RostrID, PerID,
Status, MakeupDate...
What I need: I need code that will run an append query to append all the
Roster IDs (about 150) and PerIDs into the TngJct table. (Since all people
are supposed to do the four training periods per month their Status is
tracked as present, deferred, or null, so I must have a populated jct table
to query all names, periods, and status.)
This inserts one PerID (which is PerName Apr2010A) for each Roster ID into
the the jct table:
INSERT INTO TngJct ( RostrID, PerID )
SELECT Roster.ID, 25 AS perID
FROM Roster;
Is it best to build a function and loop the incremented perID variable,
executing the query each loop?
or Can I use the PerID from the TngPer table to have the query run thru all
the 200 PerID values? I tried a subquery (Select TngPer.TngID FROM TngPer)
AS perID in the above append query but I got a message that it will only
update one record.
thanks
with PerID, PerName (four training periods per month for the next 4 years,
named like Apr2010A, Apr2010B...)... and a TngJct with JctID, RostrID, PerID,
Status, MakeupDate...
What I need: I need code that will run an append query to append all the
Roster IDs (about 150) and PerIDs into the TngJct table. (Since all people
are supposed to do the four training periods per month their Status is
tracked as present, deferred, or null, so I must have a populated jct table
to query all names, periods, and status.)
This inserts one PerID (which is PerName Apr2010A) for each Roster ID into
the the jct table:
INSERT INTO TngJct ( RostrID, PerID )
SELECT Roster.ID, 25 AS perID
FROM Roster;
Is it best to build a function and loop the incremented perID variable,
executing the query each loop?
or Can I use the PerID from the TngPer table to have the query run thru all
the 200 PerID values? I tried a subquery (Select TngPer.TngID FROM TngPer)
AS perID in the above append query but I got a message that it will only
update one record.
thanks