There's no INNER JOIN if there are no relationships.
I made up 2 tables and some fictitious dates since I had none.
I reread your posts several times and concocted some sql
based on
Code:
count of CR_NOs where the start date is greater than or equal to the Date_ID and
where the stop date is less than or equal to the Date_Closed.
My tables are:
CMB
Start_date |
Stop_date |
CMBID |
01/11/2015 |
06/11/2015 |
1 |
23/11/2015 |
26/11/2015 |
2 |
24/11/2015 |
26/11/2015 |
3 |
11/11/2015 |
14/11/2015 |
4 |
CR
Date_ID |
Date_Closed |
CR_NO |
Sub_NO |
id |
22/12/2015 |
28/12/2015 |
100 |
1 |
1 |
02/11/2015 |
07/11/2015 |
100 |
2 |
2 |
23/11/2015 |
27/11/2015 |
200 |
10 |
3 |
08/11/2015 |
15/11/2015 |
300 |
2 |
4 |
My Query
Code:
SELECT Count(CR.CR_NO) AS Count_CR
,CMB.Start_Date
,CMB.Stop_Date
,CMB.CMBID
,CR.Date_ID
,CR.Date_Closed
FROM CMB
,CR
WHERE ((CMB.Start_Date) >= ([CR].[Date_ID]))
AND (CMB.Stop_Date) <= ([CR].[Date_Closed])
GROUP BY CMB.Start_Date
,CMB.Stop_Date
,CMB.CMBID
,CR.Date_ID
,CR.Date_Closed
My result from the query
Count_CR |
Start_Date |
Stop_Date |
CMBID |
Date_ID |
Date_Closed |
1 |
11/11/2015 |
14/11/2015 |
4 |
08/11/2015 |
15/11/2015 |
1 |
23/11/2015 |
26/11/2015 |
2 |
23/11/2015 |
27/11/2015 |
1 |
24/11/2015 |
26/11/2015 |
3 |
23/11/2015 |
27/11/2015 |
Good luck.