Stangray
SAP THQ Apple Nintendo Google Reynolds Amazon Yahoo

select a.*  from USERLOGGERFILTER a where loggertime > '2010-05-31' and loggertime < '2010-06-01' and not exists(select 1 from USERLOGGERFILTER where LoggerPNR=a.LoggerPNR and loggertime<a.loggertime) order by a.airway

 

条件:

 not exists 不存在于重复的结果集中

loggertime > '2010-05-31' and loggertime < '2010-06-01' 时间范围

loggertime<a.loggertime 表示取相同LoggerPNR 中 LoggerTime最小的一行记录

 

 

posted on 2010-06-01 10:29  Stangray  阅读(1375)  评论(0编辑  收藏  举报