View Single Post
  #9 (permalink)  
Old 07-28-10, 05:14
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by nbtet View Post
However, this query only select duplicate id between 12.00 to 12.15. I also want to select the duplicate id within 12.15-12.30, 12.30-12.45 and 12.45 to 13.00. Any suggestion?
Try this
Code:
select id, t_stamp
from (
  select id, 
         t_stamp, 
         count(*) over (partition by id, extract(minute from t_stamp)::int / 15) as num_dupes
  from log
) t
where num_dupes > 1
order by t_stamp
Reply With Quote