SELECT ...
FROM [Rep_GroupNode] C
left join
(SELECT ....
if I’m using left join only for compare some thing due selecting how to not add(double) values from join ?
You’re encountering a many-to-many relationship.
Example:
So a join on
Rep_GroupNode.id = MappingTable.rgn_idreturns two (2) records forRep_GroupNode.id = 1Some methods to handle this are mentioned in the other good answers, but for a definitive answer we’d need more information about what your data look like and exactly what information you’d like to project from it.
Here’s an example (based on my sample data) of another method to avoid returning duplicate records: