Number records

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc

Poston Thu, 18 Nov 2004 8:56 am

Hello guys, I wonder if anyone knows any way to number the records of a selection without being by the rownum select rownum, cod_pro, desc_pro from cod_pro order by cadpro that way my rowid will come cluttered, because the order by der by cod_pro and if I sort on rownum também cod_pro coming cluttered I need sort the records by cod_pro and assign values sorted the records

Since já thanks!!!!!

Location: Videira - SC

Poston Thu, 18 Nov 2004 9:19 am

I think you'll have to use a sub-select.
Something like:
Code: Select all
select rownum, a.*
  (select b.cod_pro, b.desc_pro
   from cadpro b
   order by b.cod_pro) a
is this?
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

Poston Mon, 22 Nov 2004 7:56 am

I did a selfjoin
Code: Select all
select rownum, b.cdpro
from cadpro a, cadpro b
where a.cdpro = b.cdpro
worked out here ... actually I did that right after I posted in the Forum, because a it was not for me ... to a colleague ... but thanks for the strength!!

[] 's
Location: Videira - SC

Poston Thu, 13 Jan 2005 1:13 pm

Code: Select all
select ., cod_pro b . b desc_pro from cadpro b order by dense_rank over ( ) ( b desc_pro ) . order by
falou! : twisted:

Leo BBG Consultor Oracle

Return to SQL

Who is online

Users browsing this forum: Google [Bot] and 2 guests