select case when t3.fvalue is not null then t1.fmarket else 'ÆäËû' end as fclass,
       t2.fagentshortname,t1.fstorename,t1.fstartdate from DSBCRM..tstore t1
inner join DSBCRM..tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
left join DSBCRM..ttypedetail t3 on t1.fmarket=t3.fvalue and t3.ftype='Âô³¡'
where t1.siteid=$siteid$