Let's say I have these results from a subquery. They are are grouping by date with the MAX() of a unique identifier [xxxxx]. Assume the number appended to the unique identifer describes the highest number. This means the 05/08/13 unique identifer is the greatest.
I have a table with the following two dates. I expect the results in bold italic
What I'm asking to occur is when there is a date match, provide me the associated unique identifer. If there is no match on date, provide me the greatest unique identifer.
How can I do this with a query?