简体   繁体   中英

How to insert multiple results from a query into another table?

my query is below :

$qStuff=mysql_query("SELECT c.field_name,t.category_name,t.category_code, d.domain_name FROM category_fields c, taxonomy_category t, taxonomy_domain d WHERE c.category_id = t.category_id AND t.domain_id = d.domain_id AND c.field_name = '" . mysql_real_escape_string($first_word) . "'");

From the query above,the query will return the result where the input match the field_name in the table.

eg

Field_name : Define (Result from the $qStuff query) (Field_name>Category>Domain) Define>P1>Cognitive Define>C1>Affective

I have to store them in a table so that i know from that table the define has P1 and C1 as category and Cognitive and Affective as domain.How should i do that ?What will the insert query looks like ? Please help ,thanks in advance!!!

您甚至不需要执行单独的SELECT查询,因为在这种情况下mysql中存在特殊的构造: INSERT ... SELECT

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM