who us UR and why would you ask me about them?
no create :( no data, no example :(
I'll guess a little on this.
say you took all_objects and copied it into table t and have the query:
6 select owner, object_type, object_name, count(*) cnt
7 from t
8 group by owner, object_type, object_name
that seems to match your description so far. Now what you want is the third to last record from each "group" - which I think means "break the data up by owner and object_type - sort by object_name - and within each owner/object_type - get the third to last record"
that is my guess - which I have to make since you provided no real details
So, we expand our query:
3 select owner, object_type, object_name, cnt,
4 row_number() over (partition by owner, object_type order by object_name DESC) rn
5 from (
6 select owner, object_type, object_name, count(*) cnt
7 from t
8 group by owner, object_type, object_name
9 )
we broke the data up by owner, object_type and sorted backwards by object_name - assigning a number 1, 2, 3, 4, 5, ... to each row in the group - now we just:
ops$tkyte%ORA11GR2> select *
2 from (
3 select owner, object_type, object_name, cnt,
4 row_number() over (partition by owner, object_type order by object_name DESC) rn
5 from (
6 select owner, object_type, object_name, count(*) cnt
7 from t
8 group by owner, object_type, object_name
9 )
10 )
11 where rn = 3
12 /
OWNER OBJECT_TYPE OBJECT_NAME CNT RN
------------------------------ ------------------- ------------------------------ ---------- ----------
APEX_030200 FUNCTION WWV_FLOW_ITEM_COMPS 1 3
APEX_030200 INDEX WWV_MIG_SELECT_FILE_ID_IDX 1 3
APEX_030200 PACKAGE WWV_RENDER_CHART2 1 3
...
and viola - we are done.
hope my guess was correct - if not, it should be close enough that you can get what you need by using the technique I demonstrated and adapting it to your needs.