ON`cdb_threads`.`tid`=`cdb_attachments`.`tid` WHERE
`cdb_attachments`.`readperm`='0'
AND`displayorder`>='0' AND `filetype`='image/pjpeg'
GROUP BY tid LIMIT 0,1 "}
<a href="/bbs/viewthread.php?tid=[field:tid
/]">
<img src="/bbs/attachments/[field:attachment/]"
ALT="[field:subject/]"
/>
</A>
{/dede:sql}