| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Row number base on sorting order?
SELECT /* RULE */ t.col_a from MyTable t, dual d where t.col_a = d.dummy
(+)
WHERE rownum < 5
HTH,
Philippe
kimboon_at_my-dejanews.com wrote in message
<7gofh6$iva$1_at_nnrp1.dejanews.com>...
>Hi,
> I have these data :
>col_a
>-----
> D
> B
> A
> E
> C
> F
> 1. I want to assign a row number in the order of col_a, result
looks
>like this :
>
>row_no col_a
>------ -----
> 1 A
> 2 B
> 3 C
> 4 D
> 5 E
> 6 F
>
> 2. I want to retrieve the first 4 rows in the order of col_a,
result
>looks like this :
>
>col_a
>-----
> A
> B
> C
> D
>
> ROWNUM doesn't help in these cases, as it was assigned before ordering.
>
> Any help ??
> TIA !!!
>Jinwen
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Wed May 05 1999 - 05:56:53 CDT
![]() |
![]() |