Home  >  Q&A  >  body text

mysql - database multi-table joint query inserting into other libraries

The table is almost the same as below
Library A
Table 1 content

id catid  areaid   title     content   linkman
12  32     4      标题一      内容一     张三

Table 2 area

areaid  areaname 
4       中国

Table 3 category

catid     catname
 32       分类项一

Library B
Table z list
id add catg title contents username

Z table and 1 table correspond one to one
How can we improve the table in library b?

为情所困为情所困2706 days ago776

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-24 11:36:39

    insert into B.list (id, areaname, catname, title, content, linkman) select content.id, area.areaname, category.catname, content.title, content.content, content.linkman from A.content content join A.area area on content.areaid = area.areaid join A.category category on category.catid = content.catid

    reply
    0
  • Cancelreply