[英]How can I do this in SQL/phpmyadmin?
I made tables:我做了表:
books - with columns ID_Books
and Name_Books
书籍 - 具有
ID_Books
和Name_Books
列
authors - ID_Authors
and Name_Author
作者 -
ID_Authors
和Name_Author
product - ID
and Author
and Book
产品 -
ID
和Author
和Book
I need it to put in product if ID_Books
and ID_Authors
is same then put that id into ID
and in Author
put Name_Author
with corresponding id and in Book
put Name_Books
with corresponding id如果
ID_Books
和ID_Authors
相同,我需要将其放入产品中,然后将该 ID 放入ID
中,在Author
中放入具有相应 ID 的Name_Author
,在Book
中放入带有相应 ID 的Name_Books
If I got your question right, you can perform a join and add that result into the third table.如果我的问题正确,您可以执行联接并将结果添加到第三个表中。
INSERT INTO PRODUCT(ID,Author,Book)
SELECT Id_Author, Name_Author, Name_Books
FROM AUTHOR INNER JOIN BOOKS ON Id_Author = Id_Books;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.