I’m having a problem here.
I would like to select a column based on a max(timestamp) of that column, but I’m stuck at retrieving it. Let’s say I have the following data:
Comments
========
abcd 2012/08/14 8:03:03 AM more data inside <- I want to retrieve this
hshsh 2012/08/13 1:03:03 AM some other comments
hahhah 2012/08/10 8:03:03 PM test it.
My SQL to retrieve the max(timestamp) is
select max(substr(comments, instr(comments, '2012'), instr(comments, 'M') - 6)) from TABLEA
but how do I select this column based on this statement?
EDIT:
Is it possible to do this:
select comments from tableA where comments like (select max(substr(comments, instr(comments, '2012'), instr(comments, 'M') - 6)) from TABLEA)
I was hoping to get the first row of the comments column but there is no output.
I hope I’m not too vague… I’m using Oracle SQL.
You can try: