给你一条语句作参考: select * from table_name where id in (select min(id) from table_name group by A)
不明白kasoo() 的意思,这样只能选一条出来啊
SELECT * FROM tabname JOIN (SELECT a FROM tabname GROUP BY a HAVING COUNT (1) = 1) ttab ON tabname.a = ttab.a
select * from tab where A in (select A from tab group by A having count(*)=1)
或者select * from tab t1 where not exists (select * from tab t2 where t1.A=t2.A and t1.tab_id!=t2.tab_id)其中tab_id是表tab的主键或不会重复的记录
select * from tbname tb where not exists( select 0 from( select * from (select t.* ,row_number()over(partition by A order by A) rn from tbname t) where rn>1) where A=tb.A ) 比较麻烦,应该有更好的方法
select schoolname from (select schoolname,rownum as num from t_school) where num<100;
select * from table_name where id in (select min(id) from table_name group by A)
FROM tabname JOIN (SELECT a
FROM tabname
GROUP BY a
HAVING COUNT (1) = 1) ttab ON tabname.a = ttab.a
(select A from tab group by A having count(*)=1)
(select * from tab t2 where t1.A=t2.A and t1.tab_id!=t2.tab_id)其中tab_id是表tab的主键或不会重复的记录
from tbname tb
where not exists(
select 0 from(
select *
from (select t.*
,row_number()over(partition by A order by A) rn
from tbname t) where rn>1)
where A=tb.A
)
比较麻烦,应该有更好的方法