ok,
just to make the problem clearer, heres the sql
SELECT [Date],[No],(dateAdd(m,-1,[Date])) as lastmonth,sales=(select count(*) from WebmasterSales where subid in (select subid from webmastersubsites wsu inner join webmastersites wsi on wsu.siteid = wsi.siteid where webmastername=@WebmasterName and wsu.active=1) and createDateTime >= dateAdd(m,-1,#RebillInfo.[Date]) and createDateTime < dateAdd(m,-1,dateAdd(d,1,#RebillInfo.[Date])))
FROM #RebillInfo
lets say #RebillInfo contains dates from 5/15/2002 to 5/31/2002
the problem is that may has 31 days and april only has 30, so when [Date] = '5/30/2002', sales returns a wrong value
because dateAdd(m,-1,dateAdd(d,1,#RebillInfo.[Date])) returns '4/30/2002'
cheers
alan