Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question, Nissa.
Asked: October 17, 2017 - 6:02 pm UTC
Last updated: October 24, 2017 - 1:42 am UTC
Version: G
Viewed 1000+ times
SQL> create table t ( x varchar2(10)); Table created. SQL> SQL> insert into t values ('01254T'); 1 row created. SQL> insert into t values ('50300'); 1 row created. SQL> insert into t values ('50300W'); 1 row created. SQL> insert into t values ('45662'); 1 row created. SQL> SQL> select x, 2 count(*) over ( partition by substr(x,1,5)) as c 3 from t; X C ---------- ---------- 01254T 1 45662 1 50300W 2 50300 2 4 rows selected. SQL> SQL> select * 2 from ( 3 select x, 4 count(*) over ( partition by substr(x,1,5)) as c 5 from t 6 ) 7 where c = 1; X C ---------- ---------- 01254T 1 45662 1 2 rows selected.
Racer I., October 18, 2017 - 10:51 am UTC
delete from t where rowid NOT IN ( select min(rowid) keep (dense_rank first order by rowid) row_id from t group by substr(x,1,5)) or : order by x, rowid or : order by length(x), rowid
A reader, October 23, 2017 - 12:09 pm UTC
Analytic SQL got you confused? Check out Connor McDonald's complete video course.