Hi,
I have 2 tables.
create table #Policies (idno int, startdate datetime,endDate datetime)
insert into #Policies (idno,startdate,enddate) values ( '1094567','2005-11-20','2008-04-30')
create table #Payment (idno int ,ProcessDate datetime)
insert into #Payment (idno,ProcessDate )
select 1094567, '2007-08-31 '
select 1094567, ' 2007-09-30 '
select 1094567, ' 2007-11-30 '
select 1094567, '2008-01-31 '
select 1094567, ' 2008-02-29 '
select 1094567, ' 2008-03-31 '
I need to find the month/year that doesn't exist in table payment between the startdate and enddate in table Policies per idno.
The startdate in the example is '2007-07-20' and enddate '2008-04-30'.
In table payments for year 2007 there are no months 7, 10 and 12 and I see that in year 2008 month 4 is missing. I need to return the idno, months and year that is missing in the table.
I don't have a calendar table.
How can i do that?
Thanks