1

Topic: Sampling of a minimum line from row_number

There are some lines where row_number deduces them in groups.
How to make so that to select a minimum (1) line from the given groups?

2

Re: Sampling of a minimum line from row_number

RTFM

3

Re: Sampling of a minimum line from row_number

For example, there is a group of 3 lines
1 group:
bla-bla-bla 1 line
   2 line
   3 line
2 group:
bla-bla-bla 1 line
   2 line

4

Re: Sampling of a minimum line from row_number

More truly 2 groups, for example. I need to deduce From them only 1 lines.

5

Re: Sampling of a minimum line from row_number

Group

6

Re: Sampling of a minimum line from row_number

At you certain problems with presentation of thoughts in Russian.

7

Re: Sampling of a minimum line from row_number

Tihiy_Don;

SQL> ed
Wrote file afiedt.buf
1 select * from
2 (select empno, row_number () over (partition by deptno order by ename) rn from emp)
3* where rn=1
SQL> /
EMPNO RN
---------- ----------
7782 1
7876 1
7499 1

.....
stax

8

Re: Sampling of a minimum line from row_number

FIRST/LAST There is also an analytical

select max (empno) keep (dense_rank first order by ename) over (partition by deptno) from emp;