I have 5 tables :
=>posts
ID
post_author
post_content
post_title
post_status
post_name
=>items
id
title
category
item
=>terms
term_id //the category id
category //items.category
slug
=>term_taxonomy
term_taxonomy_id
term_id //the category id
taxonomy //the category name
=>term_relationships
object_id // posts.ID
term_taxonomy_id
I think the query should be like this :
insert into term_relationships (object_id,term_taxonomy_id) select a.ID, b.term_taxonomy_id from posts a, term_taxonomy b, where terms.category = item.category
How can I do an insert query with 4 tables joint ?