Can this be done? [message #371915] |
Wed, 20 December 2000 10:28 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Rob
Messages: 70 Registered: January 2000
|
Member |
|
|
Hello,
Is this a "valid" statement?
select max(yr||mo) as LatestSubmission from TableA where fieldA = 'ABC'
....with year/month data being:
ABC yr=2000 mo=1
ABC yr=2000 mo=4
ABC yr=2000 mo=7
ABC yr=2000 mo=12
....I'm assuming this should return 200012....but it isn't, I get an "earlier" result.
Is this the right way to approach this query?
Thanks
|
|
|
Re: Can this be done? [message #371921 is a reply to message #371915] |
Thu, 21 December 2000 06:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John R
Messages: 156 Registered: March 2000
|
Senior Member |
|
|
I suspect that it is returning the 2000,7 result.
If so it would be because it is doing a string comparison rather than a numeric one.
If you did max((year*100)+month) then you should get the right result
|
|
|
|