I need to change an existing report to add a column from
. based on .. I was able to join the two columns via two intermediate tables as you can see below. The issue I have is that the Foreign Key in Table 2 has multiple entries (for individual items) and this causes duplicate rows in the amended report, messing up the Cost Value in Report . How can I join to while ignoring the multiple instances in ? I have tried all types of JOINs (RIGHT, LEFT, FULL OUTER, INNER)
Table 1
Column 1: PK
Column 2: Reference in Report (column 1 in report)
Column 3: Cost Value in Report (column 3 in report)
Table 2
Column 1: PK
Column 2: FK pointing to Table 1 (multiple rows of this)
Table 3
Column 1: PK
Column 2: FK pointing to Table 2
Table 4
Column 1: PK (what I'm being asked to add as column 2 in Report)
Column 2: FK pointing to Table 3
SELECT