sql - How to group rows after another grouping in oracle? -


i have table called correctobjects. in tablet here lot of grups has different number records. 1 example given below grup 544 has 5 rows in table. firstly, should group records grup column must inner matching cap column. in grup#544 there 3 different cap values must give inner group number these records. how can these 2 level grouping process. grup column done. inner grup column null in every records. enter image description here

after inner group process, must belows: enter image description here

i using oracle 11g r2 , pl/sql developer

your question lacks details, i'll give starting point, , can tweak suit needs.

it's not entirely clear, way understand it, want rank different rows cap. , think ranking independent every distinct grup value.

what's not clear me why 125 mm ranked 1, , 62 mm ranked 2. based on value? based on row first one, , if so, how rows ordered? or maybe don't care 1 first or second, long grouped correctly. i'll have assume latter.

in case, sounds want use dense_rank() analytic function in form:

select mip, startmi, cap, grup,        dense_rank() on (partition grup order cap) inner_grup   tbl 

Comments