3

I want to do something like this:

My tb_b: --------------- B | C // Columns --------------- 'y' | 'z' // row --------------- 

EX: INSERT INTO tb_a(a,b,c) VALUES ('x',SELECT * from tb_b)

I want this result:

My tb_a: ----------------- A | B | C // Columns ----------------- 'x' | 'y' | 'z' // row ----------------- 

How to Insert into table a data and selected rows from tb_b?

1 Answer 1

4
INSERT INTO tb_a (a, b, c) SELECT 'x', tb_b.B, tb_b.C FROM tb_b 
Sign up to request clarification or add additional context in comments.

1 Comment

What does a,b,c refer to in tb_a (a, b, c)? How to insert for 3 fields in tb_a when it only have two columns?Also does SELECT 'x', tb_b.B, tb_b.C FROM tb_b means select row x , values in columns B and C

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.