order by desc with distinct
hi,
i have a problem in listing the rows order by desc.
if i do not use distinct then no problem.
if i use "distinct" and "order by desc" together
it gets sorted as ascending not descending.
this is the table structure
INVOICENUMBER NUMBER(7)
HNUM VARCHAR2(7)
here is the screen shot.
1 select invoicenumber
2 from invoices i
3 where hnum='2222222'
4 order by invoicenumber desc ;
SQL>
INVOICENUMBER
-------------
35317
35119
35117
1 select distinct invoicenumber
2 from invoices i
3 where hnum='2222222'
4 order by invoicenumber desc ;
SQL>
INVOICENUMBER
-------------
35117
35119
35317
SQL>
any idea of why and how to overcome this problem.
with thanks,
Raja