Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> SQL Query Help
Problem:
A tableT has two fields 'fieldA', 'fieldB'. fieldA is a character field
but contains
only numbers for priorities. fieldB is a character field identifying the
record.
I would like to generate a query which would return rownum,fieldA,fieldB
from
tableT but ordered by fieldA. For example, I would like to return the top
500 records from tableT. However, as we know if you use the order by
clause with rownum, rownum is based only off of the select, so rownum
would be correct for the select but as soon as the sorting takes place
with the order by clause rownum would be out of sync.
TABLE T:
fieldA number
fieldB varchar2(10)
SAMPLE DATA:
HONDA 44 TOYOTA 45 HYUNDAI 90 FORD 5 CHEVORLET 8 DESIRE: 1 FORD 5 2 CHEVORLET 8 3 HONDA 44 4 TOYOTA 45 5 HYUNDAI 90
Thanks, Wally Received on Mon Nov 24 1997 - 00:00:00 CST
![]() |
![]() |