Understanding The Logic behind your Expected output was very hard. I still don't know if I understand it completely. Is this what you are looking for:Select x.Nbr, MAX(x.amount) As Amount, MAX(x.idA) As idA, MAX(x.idB) As idB, MAX(x.idC) As idC, MIN(x.amountB) As amountB, MIN(x.amountC) As amountC From (Select D.Nbr, D.amount, Coalesce(D.idA, c.IdA) As idA, Coalesce(D.idB, c.IdB) As idB, Coalesce(D.idC, c.IdC) As idC, B.amountB, C.amountC From A JOIN B ON A.IdA = B.idA JOIN C ON A.IdA = C.idA Full JOIN D ON A.IdA = D.idA) As xGroup By x.Nbr
N 28° 33' 11.93148"E 77° 14' 33.66384"