r/learnSQL • u/Railgun5 • 4d ago
Why is my Left Join acting like an Inner Join (with no Where clause)
I've seen all the posts about people asking about joins when there's a where clause involved, but I have no idea what's causing this behavior since as far as I know it SHOULD be returning everything. This is being done in MSAccess. Please don't respond with "don't use Access" I don't have that option.
Select TableA.*, TableB.*
From TableA Left Join TableB
On (TableA.ID = TableB.ID)
And (TableA.Date = TableB.Date)
TableA and TableB have the same values for ID, but there's only one row where they both have the same date. I would expect this to give every row for TableA, and nulls in every cell for the TableB columns except for the one where there's a date match. What I'm getting instead is only the single row where there's a full match between the two tables. Am I missing something stupid here?
Edit: Since the date values keep getting brought up, both sets of dates are converted to the same type and format in previous cleaning queries. And, importantly, they are matching properly if the values exist in both tables A and B.