AndrewKent
Well-known Member
- Joined
- Jul 26, 2006
- Messages
- 889
Hi there,
I have a bit of a complex ask here:
I have a table in Access which contains individual records for staff salary as at Week 1, Week 2 ect ect and is stored as such:
Employee_ID Name Salary Week
0123 Andrew 10,000 1
0123 Andrew 10,500 2
...and so on
I need to be able to create a Query that:
1) Contains ALL staff as at Week 1, with a column for what their salary was in Week 1 and a column for what their salary was in Week 2.
The issue is that the staff population is different from one week to the next (as people join/leave) so I want to be able to show ALL staff from Week 1, not just where the join between the two tables is equal. What am I doing wrong?
A
I have a bit of a complex ask here:
I have a table in Access which contains individual records for staff salary as at Week 1, Week 2 ect ect and is stored as such:
Employee_ID Name Salary Week
0123 Andrew 10,000 1
0123 Andrew 10,500 2
...and so on
I need to be able to create a Query that:
1) Contains ALL staff as at Week 1, with a column for what their salary was in Week 1 and a column for what their salary was in Week 2.
Code:
SELECT tblData_Colleagues_Historical.ch_employeeid, tblData_Colleagues_Historical.ch_firstname, tblData_Colleagues_Historical.ch_lastname, tblData_Colleagues_Historical.ch_week, tblData_Colleagues_Historical_1.ch_weekFROM tblData_Colleagues_Historical AS tblData_Colleagues_Historical_1 RIGHT JOIN tblData_Colleagues_Historical ON tblData_Colleagues_Historical_1.ch_employeeid = tblData_Colleagues_Historical.ch_employeeid
WHERE (((tblData_Colleagues_Historical.ch_week)=5) AND ((tblData_Colleagues_Historical_1.ch_week)=9));
The issue is that the staff population is different from one week to the next (as people join/leave) so I want to be able to show ALL staff from Week 1, not just where the join between the two tables is equal. What am I doing wrong?
A