Changeset 2215
- Timestamp:
- Mar 21, 2007, 3:11:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE/branches/ebihara/prj_dev28_misc01/webapp/lib/db/commu.php
r2190 r2215 802 802 803 803 $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'; 806 808 $c_commu_topic_list = db_get_all_limit($sql, 0, $limit); 807 809 … … 819 821 $c_commu_name = db_get_one($sql, $value['c_commu_id']); 820 822 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 821 826 //最新の書き込み番号 822 827 $number = db_commu_get_max_number4topic($value['c_commu_topic_id']); … … 827 832 $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3']; 828 833 $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; 829 835 } 830 836 … … 839 845 840 846 $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'; 843 851 $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit); 844 852 … … 856 864 $c_commu_name = db_get_one($sql, $value['c_commu_id']); 857 865 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 858 869 //最新の書き込み番号 859 870 $number = db_commu_get_max_number4topic($value['c_commu_topic_id']); … … 864 875 $c_commu_topic_list[$key]['image_filename3'] = $temp['image_filename3']; 865 876 $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; 866 878 } 867 879
Note: See TracChangeset
for help on using the changeset viewer.