ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 2215


Ignore:
Timestamp:
Mar 21, 2007, 3:11:09 PM (15 years ago)
Author:
ebihara
Message:

#547 コミュニティリストのソート順が正しくなかったのを修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/ebihara/prj_dev28_misc01/webapp/lib/db/commu.php

    r2190 r2215  
    802802
    803803    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    804     $sql = 'SELECT c_commu_id, c_commu_topic_id, name AS c_commu_topic_name, r_datetime, c_member_id'.
    805         ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') ORDER BY r_datetime DESC';
     804    $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
     805        ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     806        ' GROUP BY cctc.c_commu_topic_id'.
     807        ' ORDER BY r_datetime DESC';
    806808    $c_commu_topic_list = db_get_all_limit($sql, 0, $limit);
    807809
     
    819821        $c_commu_name = db_get_one($sql, $value['c_commu_id']);
    820822
     823        $sql = 'SELECT name FROM c_commu_topic WHERE c_commu_topic_id = ?';
     824        $c_commu_topic_name = db_get_one($sql, $value['c_commu_topic_id']);
     825
    821826        //最新の書き込み番号
    822827        $number = db_commu_get_max_number4topic($value['c_commu_topic_id']);
     
    827832        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    828833        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
     834        $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
    829835    }
    830836
     
    839845
    840846    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    841     $sql = 'SELECT c_commu_id, c_commu_topic_id, name AS c_commu_topic_name, r_datetime, c_member_id'.
    842         ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') ORDER BY r_datetime DESC';
     847    $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
     848        ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
     849        ' GROUP BY cctc.c_commu_topic_id'.
     850        ' ORDER BY r_datetime DESC';
    843851    $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit);
    844852
     
    856864        $c_commu_name = db_get_one($sql, $value['c_commu_id']);
    857865
     866        $sql = 'SELECT name FROM c_commu_topic WHERE c_commu_topic_id = ?';
     867        $c_commu_topic_name = db_get_one($sql, $value['c_commu_topic_id']);
     868
    858869        //最新の書き込み番号
    859870        $number = db_commu_get_max_number4topic($value['c_commu_topic_id']);
     
    864875        $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3'];
    865876        $c_commu_topic_list[$key]['c_commu_name'] = $c_commu_name;
     877        $c_commu_topic_list[$key]['c_commu_topic_name'] = $c_commu_topic_name;
    866878    }
    867879
Note: See TracChangeset for help on using the changeset viewer.