select distinct caller, callee, dnis_eq, key_trace, start_date, start_time
from ivrlog
where start_date='20100704' and callee!='1006' order by start_date desc, start_time desc
请教各位大虾,如何如上,找出caller的非重复值,而且是同一个caller中的最小start_time的那个数据。背景:表中有17W条记录,其中caller有重复,重复的caller记录条中,是各时间段的记录。thx~
from ivrlog a
where not exists(select 1 from ivrlog b where a.caller = b.caller and a.start_time > b.start_time)
from ivrlog a
where start_time=(select min(start_time) from ivrlog b where a.caller = b.caller)
a.start_time='20100704' and a.callee!='1006' and a.callee!='1106' and
select caller, callee, dnis_eq, key_trace, ext5_skill, ext9_skill, se_id, start_date, start_time, end_date, end_time
from ivrlog a
where start_date='20100705' and callee!='1006' and callee!='1106' and start_time=(select min(start_time) from ivrlog b where start_date='20100705' and callee!='1006' and callee!='1106' and a.caller = b.caller) order by start_date asc, start_time asc
忘记贴出来了。