kalvis
Technical User
- Mar 15, 2001
- 9
I am using SQL Server 2005. I have two joined tables one for Accounts the other for Work Orders. For each Account there can be many Work Orders. A simple example of this data structure would be the following:
Accounts Work Orders
-------- -------------------
100 100, 1/1/2009, Job1
200 200, 6/1/2009, Job1
100, 12/1/2009, Job2
100, 12/10/2009, Job1
100, 6/15/2009, Job3
200, 1/1/2010, Job2
I am attempting to determine the most recent work orders completed for each account along with the job type. I am not having any issues returning the max date for each account. But, when I attempt to retrieve the additional information about the work order (Job1... etc) I begin to have issues. If someone could give me assitance with designing a query that returns the most recent date from a joined table I would greatly appreciate it.
Accounts Work Orders
-------- -------------------
100 100, 1/1/2009, Job1
200 200, 6/1/2009, Job1
100, 12/1/2009, Job2
100, 12/10/2009, Job1
100, 6/15/2009, Job3
200, 1/1/2010, Job2
I am attempting to determine the most recent work orders completed for each account along with the job type. I am not having any issues returning the max date for each account. But, when I attempt to retrieve the additional information about the work order (Job1... etc) I begin to have issues. If someone could give me assitance with designing a query that returns the most recent date from a joined table I would greatly appreciate it.