select top (1) t1.fobsurl
from tattachment t1
where t1.ownertable = 'tagentactivities'
  and t1.ftype = 'cover'
  and t1.siteid =$siteid$
  and t1.ownerid=$tagentactivitiesid$
order by t1.createdate desc