2013年6月12日星期三

PHPCMS V9转换到Wordpress的SQL语句

没玩过PHPCMS,不过有一个网站需要导入数据,于是……

创建文章:
insert into wp_posts(ID,post_title)
select id,title from phpcms_news where islink=0

修改时间:
update wp_posts a,phpcms_news b
set a.post_date=FROM_UNIXTIME(b.inputtime),a.post_date_gmt=FROM_UNIXTIME(b.updatetime)
where a.ID=b.id

添加内容:
update wp_posts a,phpcms_news_data b
set a.post_content=x.content
where a.ID=b.id

文章分类:(如原分类编号为17,新分类编号为5)
insert into wp_term_relationships(object_id,term_taxonomy_id)
select id,5 from phpcms_news where catid=17