我有一张包含2个字段的表格。如何从2 sql结果的结果中插入这2个字段。
insert into access (user,page)
(select id as user from users where id =5,
select pagename as page from pages where id =10)
2个表之间没有关系。我不认为我可以加入。
答案 0 :(得分:1)
insert into access ("user", page) values
( (select id as user from users where id =5),
(select pagename as page from pages where id =10)
)
答案 1 :(得分:1)
insert into access (user,page)
select users.id as user,
pages.pagename as page
from users,pages
where users.id = 5
and pages.id = 10