0

我试过了:

INSERT INTO wp_posts_copy * (SELECT 
        *
FROM 
        wp_posts
        JOIN wp_term_relationships
                ON wp_posts.ID = wp_term_relationships.object_id
WHERE 
   wp_term_relationships.term_taxonomy_id = "48")

SQL 数据库:

wp_posts => 
ID
post_author
post_date
post_date_gmt
post_content
post_title
post_excerpt
post_status
comment_status
ping_status
post_password
post_name
to_ping
pinged
post_modified
post_modified_gmt
post_content_filtered
post_parent
guid
menu_order
post_type 
post_mime_type
comment_count

wp_term_relationships =>
object_id
term_taxonomy_id
term_order

我想复制或导出那些属于该类别的 wp_posts,它们的 id 为 48。选择有效,但我不知道如何复制它们。那么,我怎样才能复制选定的数据呢?它来自WP数据库。

4

1 回答 1

2

要仅复制wp_posts您必须使用的列,wp_posts.*而不是*或命名您要使用的所有列

INSERT INTO wp_posts_copy
SELECT wp_posts.* FROM wp_posts
JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
WHERE wp_term_relationships.term_taxonomy_id = "48"
于 2013-06-03T13:21:48.817 回答