Number

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
User avatar
MuLtAnI
Moderador
Moderador
Posts: 90
Joined: Tue, 01 Jun 2004 9:21 am
Location: Videira - SC
Contact:

Hello everyone, I wonder if anyone knows any way to number the records of a selection without being by Rownum

Select Rownum, COD_PRO, CADPRO Order by cod_pro
99] This way my rowid will come cluttered, due to the order by d der by cod_pro and if I sort by the rownum também the cod_pro will come cluttered

I need to order the records by cod_pro and Assign values ??ordered to records ..

from já thank you !!!!!


Hugs
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

I think you'll have to use a sub-select ...
Something like:

Select all

select rownum, a.* 
from  
  (select b.cod_pro, b.desc_pro  
   from cadpro b 
   order by b.cod_pro) a 
Is this?
User avatar
MuLtAnI
Moderador
Moderador
Posts: 90
Joined: Tue, 01 Jun 2004 9:21 am
Location: Videira - SC
Contact:

I did a selfjoin

Select all

select rownum, b.cdpro 
from cadpro a, cadpro b 
where a.cdpro = b.cdpro
worked here ... Actually I did it shortly after I posted in the forum, because it was not even for me .. .Prise a colleague ...

But thanks for the force !!

[] 's
User avatar
leobbg
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 22
Joined: Fri, 29 Oct 2004 10:25 am
Location: PORTO ALEGRE - RS
Leo BBG Consultor Oracle

Select all

 
select b.cod_pro, b.desc_pro 
from  cadpro b 
order by dense_rank() over( order by b.desc_pro ) 

falou! : Twisted:
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests