Ok, I've been trying for a couple days to get this query to work work.
Here's an example of the data I'm working with:
ID | FirstName | LastName | LastUpdate
----------------------------------------------------
999 | John | Doe | <null>
9999| Jane | Doe | <null>
999 | John | Doe | 12/20/01
9999| Jane | Doe | 12/21/01
999 | John | Doe | 1/7/02
9999| Jane | Doe | 1/6/02
What I need to do is pull the Unique ID's and only pull the latest record (last updated) using ONE query. I'm beginning to think it's impossible without using some sort of code to loop through multi queries (i.e. select distinct ID then loop through the results of that and use SELECT TOP 1 * FROM .. ) So what I'm looking for as a result of the query would be something like:
ID | FirstName | LastName | LastUpdate
----------------------------------------------------
999 | John | Doe | 1/7/02
9999| Jane | Doe | 1/6/02
Can anybody answer me for sure that this can't be done with just ONE query so I can stop wasting my time and look for alternate means to get this done. Any suggestions at all as far as other methods or restructuring the database or different ways I could handle this would be appreciated.
Here's an example of the data I'm working with:
ID | FirstName | LastName | LastUpdate
----------------------------------------------------
999 | John | Doe | <null>
9999| Jane | Doe | <null>
999 | John | Doe | 12/20/01
9999| Jane | Doe | 12/21/01
999 | John | Doe | 1/7/02
9999| Jane | Doe | 1/6/02
What I need to do is pull the Unique ID's and only pull the latest record (last updated) using ONE query. I'm beginning to think it's impossible without using some sort of code to loop through multi queries (i.e. select distinct ID then loop through the results of that and use SELECT TOP 1 * FROM .. ) So what I'm looking for as a result of the query would be something like:
ID | FirstName | LastName | LastUpdate
----------------------------------------------------
999 | John | Doe | 1/7/02
9999| Jane | Doe | 1/6/02
Can anybody answer me for sure that this can't be done with just ONE query so I can stop wasting my time and look for alternate means to get this done. Any suggestions at all as far as other methods or restructuring the database or different ways I could handle this would be appreciated.