0

我有一个有 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 个表之间没有关系。我不认为我可以加入。

4

2 回答 2

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)
)
于 2013-04-12T17:32:55.123 回答
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
于 2013-04-12T17:43:50.047 回答