hey guys. I need some help on a query that I'm have a lot of problems with.
I have the following two tables. There's a 1 to many relationship between the two tables.
Project
ID Project
=== =======
1 Testing
2 Planning
3 Development
Status
ID StatusDate Status
=== ========== =======
1 10/30/03 New Project
1 11/30/03 In Progress
2 10/30/03 New Project
2 11/30/03 In Progress
3 11/30/03 In Progress
3 12/30/03 Completed
What I need to do is run a query where I will be able to pull the latest status date and status of each project along with the project name and ID. The current results lists all the record twice with the corresponding statusDate and Status but i wanted it to list the ID and Project status only once along with the latest status date and the corresponding status for that date.
Desired Result.
ID Project StatusDate Status
=== ======= ========== ======
1 Testing 11/30/03 In Progrress
2 Planning 11/30/03 In Progress
3 Development 12/30/03 Completed
I've tried using Max(StatusDate) and group by, but group by only works if i group by ID, but that only works if i hav ID and StatusDate showing and i need all the fields to be displayed. Any help would be much appreciated. Thanks
I have the following two tables. There's a 1 to many relationship between the two tables.
Project
ID Project
=== =======
1 Testing
2 Planning
3 Development
Status
ID StatusDate Status
=== ========== =======
1 10/30/03 New Project
1 11/30/03 In Progress
2 10/30/03 New Project
2 11/30/03 In Progress
3 11/30/03 In Progress
3 12/30/03 Completed
What I need to do is run a query where I will be able to pull the latest status date and status of each project along with the project name and ID. The current results lists all the record twice with the corresponding statusDate and Status but i wanted it to list the ID and Project status only once along with the latest status date and the corresponding status for that date.
Desired Result.
ID Project StatusDate Status
=== ======= ========== ======
1 Testing 11/30/03 In Progrress
2 Planning 11/30/03 In Progress
3 Development 12/30/03 Completed
I've tried using Max(StatusDate) and group by, but group by only works if i group by ID, but that only works if i hav ID and StatusDate showing and i need all the fields to be displayed. Any help would be much appreciated. Thanks