Output for the given code is in the url below. Each ACCOUNT is repeated twice. Now i want to change the code so that the difference between EDATE is 90 days for the same ACCOUNT( for example ACCOUNT = 10002961, difference between 10/27/2010 and 11/22/2010).Display only the one's with difference 90.
select
b.ACCOUNT ACCOUNT
, Trunc (a.ENTRY_DATE) EDate
from CIRC.SUBS_TAG a, CIRC.TAG c, DSIPROC.TRB_SUBS_INFO b
join
(
select b.ACCOUNT
from CIRC.SUBS_TAG a, DSIPROC.TRB_SUBS_INFO b, CIRC.TAG c
where a.ACCOUNT= b.ACCOUNT and a.CODE=c.CODE
group by b.account
having count(1) >1
) z on z.account = b.account
where a.ACCOUNT= b.ACCOUNT and a.CODE=c.CODE
order by b.account, a.entry_date
[http://img153.imageshack.us/i/image1he.png/]