随便取一条? select * from (select a.*,row_number()over(partition by a order by rownum)rn from a) where rn=1
select * from (select a.*,row_number()over(partition by a order by rownum)rn from a) where rn=1
------测试数据如下 --a---------------b---- 2 bbb 1 aaa 2 ddd 2 cccselect * from (select a.*,row_number()over(partition by a.col order by rownum)rn from a) where rn=1-----查询出来数据如下: --a----------b-- 1 aaa 2 ccc
------测试数据如下 --a--b-- 2 bbb 1 aaa 2 ddd 2 cccselect * from (select a.*,row_number()over(partition by a.col order by rownum)rn from a) where rn=1-----查询出来数据如下: --a--b-- 1 aaa 2 ccc
select * from debug a where rowid = (select max(rowid) from debug b where a.id=b.id)
这个debug是个什么意思 没见过
select * from tab a where not exists( select 1 from tab b where a.a=b.a and a.rowid<b.rowid);
select * from (select a.*,row_number()over(partition by a order by dbms_random.random) rn from a) where rn = 1;
select * from
(select a.*,row_number()over(partition by a order by rownum)rn
from a)
where rn=1
(select a.*,row_number()over(partition by a order by rownum)rn
from a)
where rn=1
--a---------------b----
2 bbb
1 aaa
2 ddd
2 cccselect * from
(select a.*,row_number()over(partition by a.col order by rownum)rn
from a)
where rn=1-----查询出来数据如下:
--a----------b--
1 aaa
2 ccc
--a--b--
2 bbb
1 aaa
2 ddd
2 cccselect * from
(select a.*,row_number()over(partition by a.col order by rownum)rn
from a)
where rn=1-----查询出来数据如下:
--a--b--
1 aaa
2 ccc
where rowid = (select max(rowid) from debug b where a.id=b.id)
没见过
where not exists( select 1 from tab b where a.a=b.a and a.rowid<b.rowid);
(select a.*,row_number()over(partition by a order by dbms_random.random) rn from a)
where rn = 1;