Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

IF/ELSE query for date results - forum topic by rsmit75

$
0
0

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.
05/05/13 xxxx1
05/07/13xxxx2
05/08/13 xxxx3
I have a table with the following two dates. I expect the results in bold italic
05/06/13 xxxx3
05/07/13 xxxx2
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?

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>