Question :
I am using query design to join data, however, when I use the sql code below, where ever there is no value, the query assigns a value to it (see image below). see the blue section where the AIBL code should only have one residential land use for 500m, yet it duplicates the data to align with the other aibl code (with more land use types).
SELECT *
FROM dbo_AIBLVIC_LUM_PORTION_500 LEFT JOIN dbo_AIBLVIC_LUM_PORTION_1600
ON dbo_AIBLVIC_LUM_PORTION_500.AIBL = dbo_AIBLVIC_LUM_PORTION_1600.AIBL;
Answer :
If the aim of the query is to join rows from the tables that match the “land_use” as well, then you need to include those columns in the join condition:
SELECT ...
FROM dbo_AIBLVIC_LUM_PORTION_500 AS alp500
LEFT JOIN dbo_AIBLVIC_LUM_PORTION_1600 AS alp1600
ON alp500.AIBL = alp1600.AIBL
AND alp500.LAND_USE_500 = alp1600.LAND_USE_1600 ; -- added condition