select t1.tagentactivitiesid,
       t2.ftitle,
       t2.fphonenumber,
       t2.fnotes,
       case when t1.fsaler2id is null then t1.fsaler1id else t1.fsaler2id end as fsalerid,
       case when t1.fsaler2id is null then t1.fsaler1 else t1.fsaler2 end     as fsaler
from tagentactivities_share t1
         inner join tagentactivities t2 on t1.siteid = t2.siteid and t1.tagentactivitiesid = t2.tagentactivitiesid
where t1.siteid =$siteid$ and t1.tagentactivities_shareid = $tagentactivities_shareid$