>  기사  >  데이터 베이스  >  Oracle数据库使用distinct多个字段

Oracle数据库使用distinct多个字段

WBOY
WBOY원래의
2016-06-07 17:36:032351검색

select DISTINCT(t.f_resume_id||t.f_resume_status),t.f_resume_status,t.f_resume_status,t.f_recruit_channel, t.f_sma

select DISTINCT(t.f_resume_id||t.f_resume_status),t.f_resume_status,t.f_resume_status,t.f_recruit_channel,
      t.f_small_channel_id
                from css.T_RESUME_INFO t  where t.f_resume_status in (80011,80012)

distinct多个字段,当然相同的功能也可用group by 完成
select a,b,c,min(d) d
from A
group by a,b,c

通过使用 group就可以出去相同的返回结果。就不需要使用distinct了。
二者效率,最好需要哪个的时候用哪个,group by是用来分组统计的,能用disitnct的地方就不要用group by 了。

网友摘录:
用group  by  和rownum嵌套,但distinct  效率高

linux

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.