Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[疑问] 谁懂SQL语句进来看看

[复制链接]
huamutongyou 发表于 2009-8-14 01:37:01 | 显示全部楼层 |阅读模式
我调用带图片的主题贴子,用sql语句结果调出了所有图片,比如,一个主题带有3张图片附件,那么,这个主题会在列表里出现三遍,下面是我问别人的调用语句,改哪里可以实现一个不重复的调用十个不同的带图片附件的贴子呢?
  1. "select cdb_threads.tid,cdb_attachments.attachment,cdb_threads.subject from cdb_threads,cdb_attachments where cdb_threads.tid in (select distinct  cdb_threads.tid from cdb_threads,cdb_attachments where cdb_attachments.isimage=1 and cdb_attachments.tid=cdb_threads.tid order by cdb_threads.tid desc) and cdb_attachments.tid=cdb_threads.tid order by cdb_threads.tid desc limit 0,10"
复制代码
回复

使用道具 举报

popuppp 发表于 2009-8-14 02:00:05 | 显示全部楼层
慎用这个。
回复

使用道具 举报

 楼主| huamutongyou 发表于 2009-8-14 10:15:38 | 显示全部楼层
怎么说???      .
回复

使用道具 举报

桃子(小敏) 发表于 2009-8-14 11:10:12 | 显示全部楼层
LZ可以使用Discuz!后台的数据调用啊
即可站内调用,也可站外调用
回复

使用道具 举报

huihui0103 发表于 2009-8-14 12:55:38 | 显示全部楼层
你这句写了也是白写啊

where cdb_threads.tid in (select distinct  cdb_threads.tid from cdb_threads,cdb_attachments where cdb_attachments.isimage=1 and cdb_attachments.tid=cdb_threads.tid order by cdb_threads.tid desc)
回复

使用道具 举报

yibaika 发表于 2009-8-19 15:31:45 | 显示全部楼层
没有改过((em:13))
回复

使用道具 举报

12153556 发表于 2009-8-19 15:35:55 | 显示全部楼层
LZ可以使用Discuz!后台的数据调用啊
即可站内调用,也可站外调用
桃子(小敏) 发表于 2009-8-14 11:10 AM

此为正解...........
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-15 20:16 , Processed in 0.087454 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表