Try this.
You can add a where clause as appropriate to the inner select.
select rownum, history_id from (select rownum, history_id from
cust_history order by fld1);
HTH
John
-----Original Message-----
From: TABAKU Dritan
[mailto:oracledba-ezmlmshield-x30492089.[Email address protected]
Sent: 27 December 2007 09:45
To: LazyDBA Discussion
Subject: Incremental rownum !
Dear all,
In following sql rownum display the row_id where the record is found;
Select histroy_id, rownum from cust_history
output
histroy_id rownum
----------------------------
5 20
8 30
9 33
How can I select row in incremental order so for id = 5 rownum = 1 and
so on for id=8 rownum = 2 etc?
For me is not important to have rownum as they are in table I need to
have them as index 1, 2 , 3, 4 , 5 for each record from history_id.
Thanks
________________________________________
Dritan TABAKU
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
-----------------------------------------
Information in this email including any attachments may be
privileged, confidential and is intended exclusively for the
addressee. The views expressed may not be official policy, but the
personal views of the originator. If you have received it in error,
please notify the sender by return e-mail and delete it from your
system. You should not reproduce, distribute, store, retransmit,
use or disclose its contents to anyone.
Please note we reserve the right to monitor all e-mail
communication through our internal and external networks.
SKY and the SKY marks are trade marks of British Sky Broadcasting
Group plc and are used under licence. British Sky Broadcasting
Limited (Registration No. 2906991), Sky Interactive Limited
(Registration No. 3554332), Sky-In-Home Service Limited
(Registration No. 2067075) and Sky Subscribers Services Limited
(Registration No. 2340150) are direct or indirect subsidiaries of
British Sky Broadcasting Group plc (Registration No. 2247735). All
of the companies mentioned in this paragraph are incorporated in
England and Wales and share the same registered office at Grant
Way, Isleworth, Middlesex TW7 5QD.
Oracle LazyDBA home page