I am trying to choose the employee who worked the most hours on each project however it is just picking the first attribute for each projectID.
The assignment table:
+-----------+----------------+-------------+
| ProjectID | EmployeeNumber | HoursWorked |
+-----------+----------------+-------------+
| 1000 | 1 | 30.00 |
| 1000 | 8 | 75.00 |
| 1000 | 10 | 55.00 |
| 1100 | 4 | 40.00 |
| 1100 | 6 | 45.00 |
| 1200 | 1 | 25.00 |
| 1200 | 2 | 20.00 |
| 1200 | 4 | 45.00 |
| 1200 | 5 | 40.00 |
| 1300 | 1 | 35.00 |
| 1300 | 8 | 80.00 |
| 1300 | 10 | 50.00 |
| 1400 | 4 | 15.00 |
| 1400 | 5 | 10.00 |
| 1400 | 6 | 27.50 |
+-----------+----------------+-------------+
And my view table to display the employee who worked the most hours on each project:
+----------------+-------+-----------+
| EmployeeNumber | MAX | ProjectID |
+----------------+-------+-----------+
| 1 | 75.00 | 1000 |
| 4 | 45.00 | 1100 |
| 4 | 45.00 | 1200 |
| 1 | 80.00 | 1300 |
| 4 | 27.50 | 1400 |
+----------------+-------+-----------+
Any ideas as to why it's showing employee numbers 1, 4, 4, 1, 4 instead of 8, 6, 4, 8 ,6?