Here's a simplified version of my database:
I have 2 tables:
tblPersons (personID, LName, FName)
tblWorkLoad (personID, WorkMonth, WorkType, WorkHours)
I'd like to make a query which calculates the hours worked for each type of work for each person.
For example, if the tables were populated as follows:
tblPersons.personID tblPersons.LName tblPersons.FName
1................................Smith......................John
2................................Doe........................Jane
tblWorkLoad.personID tblWorkLoad.WorkMonth tblWorkLoad.WorkType tblWorkLoad.WorkHours
1...................................August................................administrative........................8
1...................................August................................administrative........................8
1...................................August................................technical................................8
1...................................August................................technical................................8
1...................................August................................technical................................8
2...................................August................................administrative........................8
2...................................August................................technical................................8
2...................................August................................technical................................8
2...................................August................................technical................................8
2...................................August................................technical................................8
the query results would produce:
tblPersons.personID tblPersons.LName tblPersons.FName tblWorkLoad.WorkMonth tblWorkLoad.WorkType tblWorkLoad.WorkHours
1...................................Smith........................John.......................August...................administrative...................16
1...................................Smith........................John.......................August...................technical...........................24
2...................................Doe..........................Jane........................August...................administrative...................8
2...................................Doe..........................Jane........................August...................technical...........................32
I know I am able to do this with a bunch of separate queries first isolating each person, then the work type, then using a form to select the month and displaying the desired results but I'm sure there is an easier way, probably with a simple sql code. Can anyone offer such a simple solution? Thanks.
I have 2 tables:
tblPersons (personID, LName, FName)
tblWorkLoad (personID, WorkMonth, WorkType, WorkHours)
I'd like to make a query which calculates the hours worked for each type of work for each person.
For example, if the tables were populated as follows:
tblPersons.personID tblPersons.LName tblPersons.FName
1................................Smith......................John
2................................Doe........................Jane
tblWorkLoad.personID tblWorkLoad.WorkMonth tblWorkLoad.WorkType tblWorkLoad.WorkHours
1...................................August................................administrative........................8
1...................................August................................administrative........................8
1...................................August................................technical................................8
1...................................August................................technical................................8
1...................................August................................technical................................8
2...................................August................................administrative........................8
2...................................August................................technical................................8
2...................................August................................technical................................8
2...................................August................................technical................................8
2...................................August................................technical................................8
the query results would produce:
tblPersons.personID tblPersons.LName tblPersons.FName tblWorkLoad.WorkMonth tblWorkLoad.WorkType tblWorkLoad.WorkHours
1...................................Smith........................John.......................August...................administrative...................16
1...................................Smith........................John.......................August...................technical...........................24
2...................................Doe..........................Jane........................August...................administrative...................8
2...................................Doe..........................Jane........................August...................technical...........................32
I know I am able to do this with a bunch of separate queries first isolating each person, then the work type, then using a form to select the month and displaying the desired results but I'm sure there is an easier way, probably with a simple sql code. Can anyone offer such a simple solution? Thanks.