Table 1 has the join field (fieldY) duplicated many times within this table although every row in totality is unique.
When I try to run a left join
I am getting 20x more rows than expected. I have tried to use solutions this post with no luck.
My expectation is that the join would yield exactly as many rows as table1 without the join. The join would just bring in one more column (fieldX
)
Any ideas?
SELECT
table1.*, table2.fieldZ
FROM
table1
LEFT JOIN
table2
ON
table2.fieldX = table1.fieldY
WHERE
criteria1 = '01/01/2019'
AND
criteria2 > '0'
ORDER BY
criteria2
In below photo:
fieldz
= Routing #
fieldX
= Bank Account #
(From table2)
fieldY
= Bank Account #
(From table1)
*This can be joined by student ID or Bank Account #, but the problem is the same regardless because both Student ID & Bank Account # appear multiple times in Table 1`