附件查询_类型.sql 828 B

1234567891011121314151617181920
  1. select t1.siteid
  2. , t1.ownerid
  3. , t1.ownertable
  4. , t1.ftype
  5. , t1.fdocument
  6. , t1.tattachmentid
  7. , t1.postfix
  8. , t1.serialnumber
  9. , t1.fobsurl
  10. , t2.fobsurl as fobsurl_thumbnail
  11. , t3.fobsurl as fobsurl_compressed
  12. , t4.fobsurl as fobsurl_hls
  13. , t1.createdate
  14. , t1.contentlength
  15. from tattachment t1
  16. left join tattachment t2 on t1.siteid=t2.siteid and t1.tattachmentid=t2.fparentid and t2.ftype='thumbnail'
  17. left join tattachment t3 on t1.siteid=t3.siteid and t1.tattachmentid=t3.fparentid and t3.ftype='compressed'
  18. left join tattachment t4 on t1.siteid=t4.siteid and t1.tattachmentid=t4.fparentid and t4.ftype='hls'
  19. where t1.ownertable =$ownertable$ and t1.ftype=$ftype$ and t1.siteid=$siteid$ and t1.ownerid in $ownerid$ and isnull(t1.fparentid,0)=0
  20. order by t1.tattachmentid