0

i have a table with 2 fields. How can i insert those 2 fields from result of 2 sql result.

 insert into access (user,page)
(select id as user from users where id =5,
select pagename as page from pages where id =10)

There is no relation between 2 tables . i dont think i can join .

1
  • 2
    Is there any sort of relationship between users and pages? Can you give some sample data to show what you're trying to do? Commented Apr 12, 2013 at 17:30

2 Answers 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)
)
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.