I know! SQL can be strange and throw up peculiar results at times, but this is really simple SQL with an allegedly simple result.
What I have is 3 tables.
Table 1: One column, which is a list of dates covering every day between 31.12.2019 and 31.12.2023.
Table 2: Two columns: Column 1 is the date of an event and column 2 is the count of the number of times the event occurred on the date in column 1.
Table 3: Two columns: Column 1 is the date of a different event and column 2 is the count of the number of times the event occurred on the date in column 1.
I want to combine the three tables into a three-column table (date, occurrences of event 1, occurrences of event 2).
SQL (it doesn't get much simpler)
SELECT t1.Date, t2."N Rows", t3."N Rows" AS "N Rows 2"
FROM Date_to_2024 t1
LEFT OUTER JOIN QNs_Opened t2
ON ( t1.Date = t2."Created On" )
LEFT OUTER JOIN QNs_Closed t3
ON ( t1.Date = t3."Completn date" )
Table 1: (Plenty of Data occurring after 10/08/2021)
Table 2: (Plenty of Data occurring after 10/08/2021)
Query Result
Data from table 1 ("Created on", "N Rows 2") - Correct.
Data from table 2 ("Completn Date", "N Rows") - Correct until 10/08/2021, then no further data.
I've tried switching table 1 and table 2. I've tried importing the data again and re-running the query. I have recreated the query from scratch...no luck.
Any ideas?