- 论坛徽章:
- 0
|
现在有两个表A thread B posts
表A thread threadid
表B posts postid message threadid
表A 54是主题
表B 122 131 137 都是 都属于thread 54 其中122( 也就是一个主题最新发表的帖子postid) message 是主题thread 54主题的内容 131 137是主题thread 54主题的回帖
$sql_select = "select threads.threadid,posts.postid,message from threads left join posts on threads.threadid=posts.threadid where 。。order by。。。LIMIT。。。。";
$sql_result = $db->query($sql_select);
while($row = $db->get_row($sql_result)){
略去n....。
$row['message']
略去n....。
通过这个语句同时读取表A threadid 和表B 里 等于threadid最小 上面的SQL语句对不对 PS:也不知道大大们看懂了没
[ 本帖最后由 cnhunk 于 2008-7-2 21:04 编辑 ] |
|