prady_1988 (10/5/2012)
Sorry, I may have mislead you.The values under Relationship is taken from 2 tables.
Table1 -> AssetID, AssetName
Table2 -> Relationship1
Table3 -> Relationship2
Table4 -> Company
Hence for each record I am getting duplicate values since one of the Relationship is null and the other has value
The sample query I have something like:
Select A.AssetID, A.AssetName, B.Relate as Relationship, C.Company
from table and joins
union
Select A.AssetID, A.AssetName, B.Relatedby as Relationship, C.Company
from table and joins
If you post the whole query, we won't have to make so many guesses.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden