Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: [Beginner] Problem with Order by of a date
On Tue, 08 Nov 2005 09:04:55 -0800, fmarchioni wrote:
> Hi all,
> I'm building a query where I need to retrieve just 1 one row,
> which must be that with the highest Date (I mean that which
> is closest to the moment where the query is issued)
>
> SELECT a.lista_campi_tpr, date_import
> FROM CELL_PR cp
> WHERE cp.id_cella = 'PZ81U1'
> AND ROWNUM < 2
> ORDER BY date_import DESC
>
> The Date is date_import.......
> unfortunately that doesn't work..........
> anybody can help me ?
> Thanks
> Francesco
A few questions:
SQL> create table test as select object_name, object_id from all_objects;
Table created.
SQL> select count(*) from test;
COUNT(*)
11500
SQL> select substr(object_name, 1, 30)
2 from ( select object_name
3 from test 4 order by object_id desc)
SUBSTR(OBJECT_NAME,1,30)
-- Hans Forbrich Canada-wide Oracle training and consulting mailto: Fuzzy.GreyBeard_at_gmail.com *** Top posting relies guarantees I won't respond. ***Received on Tue Nov 08 2005 - 11:20:07 CST