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

Changeset 6518


Ignore:
Timestamp:
Apr 11, 2008, 2:11:39 PM (12 years ago)
Author:
toraneko
Message:

#2178 トピックコメント記入履歴時間用のコンバート

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/toraneko/prj_dbtuning/setup/sql/mysql41/update/update-for2.12-db-tuning.sql

    r6508 r6518  
    2222CREATE INDEX `c_member_id_c_diary_id` ON `c_diary_comment_summary`(c_member_id,c_diary_id);
    2323
     24/* 既存データのコンバート */
     25/* コメント記入履歴時間  */
     26DROP TABLE IF EXISTS `tmp_c_commu_topic`;
     27CREATE TABLE `tmp_c_commu_topic` (
     28  `c_commu_topic_id` int(11) NOT NULL default '0',
     29  `r_datetime_comment` datetime NOT NULL default '0000-00-00 00:00:00',
     30  PRIMARY KEY  (`c_commu_topic_id`)
     31) ENGINE=MyISAM DEFAULT CHARSET=utf8;
     32
     33INSERT INTO tmp_c_commu_topic (c_commu_topic_id, r_datetime_comment)
     34  (SELECT cct.c_commu_topic_id, MAX(cctc.r_datetime) as r_datetime_comment
     35     FROM c_commu_topic_comment AS cctc ,c_commu_topic AS cct
     36     WHERE cctc.c_commu_topic_id = cct.c_commu_topic_id
     37     GROUP BY cct.c_commu_topic_id);
     38
     39UPDATE c_commu_topic INNER JOIN tmp_c_commu_topic USING (c_commu_topic_id)
     40 SET c_commu_topic.r_datetime_comment = tmp_c_commu_topic.r_datetime_comment;
     41
     42DROP TABLE tmp_c_commu_topic;
     43
Note: See TracChangeset for help on using the changeset viewer.