Combining multiple queries I have 2 queries given below. Now I want to have one quey by combining the two queries so as to get the table with columns (Tag Number, Primary Name and Discoverd Name)

Query 1:

select  RT.[TagName] as 'Tag Number',
        RA.SourceName as 'Primary Document',
        RA.SourceRevision
from dbo.REP_TTA as RT 
join dbo.REP_ASS as RA on RA.TargetName=RT.TagName
where RA.[AssocName]='is a document for'


Query 2:

select RT.[TagName] as 'Tag Number',
       RA.SourceName as 'Discoverd Document',
      RA.SourceRevision 
from dbo.REP_TransposedTagAttributes as RT 
join dbo.REP_ASS as RA on RA.TargetName=RT.TagName
where RA.[AssociationName]='refers to'
As far as I can guess, you have 'Primary Document' and 'Discovered Document' in different rows of REP_ASS, which means you'll need to join REP_ASS twice anyway... So here it goes:

select RPrimary.[TagName] as 'Tag Number',
       RPrimary.sourceName as 'Primary Document',
       RDiscovered.SourceName as 'Discoverd Document',
       RPrimary.SourceRevision
from
    (select  RT.[TagName],
            RA.SourceName,
            RA.SourceRevision
    from dbo.REP_TTA as RT 
    join dbo.REP_ASS as RA on RA.TargetName=RT.TagName
    where RA.[AssocName]='is a document for'
    ) AS RPrimary
inner join --or outer if you don't have them all in both tables yet want them all
    (select RT.[TagName],
           RA.SourceName
    from dbo.REP_TransposedTagAttributes as RT 
    join dbo.REP_ASS as RA on RA.TargetName=RT.TagName
    where RA.[AssociationName]='refers to'
    ) AS RDiscovered
on RPrimary.[TagName] = RDiscovered.[TagName]