I have a MS Access database for employee training and there is a class that each employee is required to have twice a year.
The table for that class looks like this:
EmployeeID ClassDate ClassHours
1 1/1/2011 8
1 7/31/2011 7
2 2/1/2011 8
2 8/31/2011 7
3 3/1/2011 8
3 9/30/2011 7
I want the table to be formated like this:
EmployeeID ClassDate_1 ClassHours_1 ClassDate_2 ClassHours_2
1 1/1/2011 8 7/31/2011 7
2 2/1/2011 8 8/31/2011 7
3 3/1/2011 8 9/30/2011 7
How do I write a query to move the second class date and hour fields to the same row based off the EmployeeID?
I have researched through this site and all the possible solutions appear to be overly complicated for what I am trying to acheive.
Your help is greatly appreciated.
Thanks
You will have to create a query with a sub-select
Alternatively you could store the nested select as a query (let’s call it
query1):and then use it in a second query
It would be much easier if the hours were not displayed
Indeed there is a simpler solution, however it assumes that the table is sorted by
EmployeeIDandClassDate. This assumption is not safe, as no natural sort order is guaranteed. Access can “decide” to reorganize the records in a different way at any time.Here again a sub-select can help
Howsoever, either a sub-query or a second query is required.