How to order by the last two dates?

Hello

I try to get the result in a table with the highest of the two dates. First date is a date created_on, the second date is "updated_on". I want to display the rows ordered by the last day between these two.

I've tried this application without result.
SELECT 
  name "Nom",
  updated_on, created_on,
  greatest (updated_on, created_on) latest
FROM  doclib_documents
order by latest desc
Below is an example of the table data.
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('readme.txt',to_timestamp('08/03/2010 15:16:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 11:22:41','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('doc_library_readme_0.92.txt',to_timestamp('12/02/2010 13:32:30','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 11:26:14','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('01_informatique.pdf',to_timestamp('10/02/2010 13:49:34','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 16:29:00','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('readme.txt',to_timestamp('08/03/2010 15:16:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('16/02/2010 11:40:16','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dataguardproblem.txt.txt',to_timestamp('03/03/2010 11:19:44','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('16/02/2010 11:41:03','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('f110.sql',to_timestamp('03/03/2010 10:59:08','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('10/02/2010 13:44:45','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.jpg',to_timestamp('08/03/2010 14:22:00','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('08/03/2010 14:17:42','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dads.conf',to_timestamp('03/03/2010 11:19:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:19:30','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.doc',to_timestamp('10/02/2010 13:49:46','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:20:28','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.doc',to_timestamp('15/02/2010 16:08:06','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:33:02','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dataguardproblem.txt.txt',to_timestamp('03/03/2010 10:57:52','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:36:15','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('access.rtf',to_timestamp('10/02/2010 13:38:25','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 12:10:57','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('temp.sql',to_timestamp('12/02/2010 14:43:58','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('11/02/2010 09:59:56','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('evv_E022_doublons.txt',to_timestamp('15/02/2010 15:55:02','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/02/2010 15:59:45','DD/MM/RR HH24:MI:SSXFF'));
Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('evv_E022_doublons.txt',to_timestamp('15/02/2010 16:05:58','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/02/2010 16:00:25','DD/MM/RR HH24:MI:SSXFF'));
Thanks for you help!

Christian

It does not work for me

select t.*, greatest(updated_on, created_on) latest_date
  from "table_export" t
order by latest_date desc

Tags: Database

Similar Questions

Maybe you are looking for

  • Satellite L670-105 - HDD compatibility

    I had to repair my Satellite L670-105 system partition, I believe that the HARD drive is MK6475GSX, as some groups failed, I think it would be prudent to replace the disk. Then I think to install a MQ01ABD100 with or without SSD addon (in any case th

  • EliteBook 840: unable to boot from usb flash

    Hello: I'm tempted to boot from USB drive to install a new version of Windows 7. When I press F9, I have only two startup options: -Computer portable hard drive -Computer laptop Ethernet The USB boot option do not appear. My BIOS Version is: 01.04 wo

  • Rename files photo for a slide show

    When I created a card SD of a photo album to show the slideshow on another PC or my digital photo frame, photos get all out of sequence.  I carefully regulated the photos in chronological order, move some more strange files and phone in order and I h

  • Size of windows of Jabber

    When I open first the Jabber client on my desktop (Windows), it is very large.  It seems that it can only be shrunk down so much.  There are really a lot of space lost on this client.  Also when I make a call, there is a large white space on the left

  • BlackBerry 10 can not send emails to someone, not in the contacts list

    Brand new here and searched this forum and elsewhere for this problem, but the gaps came. I got my Z10 launch day at the Canada and he likes most of the time. Most of the questions I had were actually lack of Telus. (Implemented my Telus email accoun