SELECT t.*,a.* FROM discuz1.cdb_threads t INNER JOIN discuz1.cdb_attachments a ON t.tid=a.tid WHERE a.isimage=1 and t.attachment=1 group by t.tid ORDER BY t.views DESC
不行的,唯一性限制是用distinct来限制的:
SELECT DISTINCT t.tid,t.*,a.* FROM discuz1.cdb_threads t INNER JOIN discuz1.cdb_attachments a ON t.tid=a.tid WHERE a.isimage=1 and t.attachment=1 ORDER BY t.views DESC
不行的,唯一性限制是用distinct来限制的:
SELECT DISTINCT t.tid,t.*,a.* FROM discuz1.cdb_threads t INNER JOIN discuz1.cdb_attachments a ON t.tid=a.tid WHERE a.isimage=1 and t.attachment=1 ORDER BY t ...
lidq.jingwu 发表于 2009-7-30 10:35
SELECT DISTINCT t.tid,t.*,a.* FROM discuz1.cdb_threads t INNER JOIN discuz1.cdb_attachments a ON t.tid=a.tid WHERE a.isimage=1 and t.attachment=1 and t.fid=? ORDER BY t.views DESC
在上面的SQL中,t.fid后面的值是固定的,只能调用单个版块的图片。