not entirely certain where you're headed with all of this; but lets get some code out there for discussion; let me know how this falls short of what you're trying to do.-- example tabledeclare @tbl table (id int identity(1,1), dateStart smalldatetime, dateEnd smalldatetime, refNbr smallint);-- some test datainsert @tblselect '10/1/10', '10/31/10', 5 union allselect '10/5/10', '10/31/10', 7 union allselect '10/13/10', '10/31/10', 10 -- simple report params; start-enddeclare @rptDateStart smalldatetime, @rptDateEnd smalldatetime;select @rptDateStart='10/10/10', @rptDateEnd='10/16/10';-- sum of refNbr where range falls entirely within the specified report period (no partial credit for starting or ending in the window)select sum(refNbr) total from @tbl where dateStart<=@rptDateStart and dateEnd>=@rptDateEnd
_____________________________wrote this on my TRS-80 COCO4<PakRat/>