I have 2 tables. The DateTable is a table with just dates. RecordTable is a table with 40million unique records.
In RecordTable, each record has a StartDate and an EndDate.
I want to iterate through DateTable, and COUNT how many records in RecordTable WHERE the date from DateTable is BETWEEN StartDate and EndDate.
Example - DateTable has the following 2 records: 2014-07-27 2014-07-28
I first want to know the number of records in RecordTable that 2014-07-27 is BETWEEN StartDate and EndDate.
I then want the next line to show me the the number of records in RecordTable that 2014-07-28 is BETWEEN StartDate and EndDate.
Is this a loop? or is their a way to do in a Query?