0

So this is the query I am trying, definately doesnt work.

The subquery returns 3 rows, which I want copied to the new table.

INSERT INTO retired
VALUES (SELECT * from questions where status = 'R');

I was sure looking at it I was doing it wrong, but here is specifically the question:

Do I need to list all the columns separately, or is there a way to tell it just to move the whole row? The tables attributes and columns are identical.

user3175451
  • 163
  • 1
  • 14
  • Duplicate - see this: http://stackoverflow.com/questions/9692319/how-can-i-insert-values-into-a-table-using-a-subquery-with-more-than-one-result – citizenen Jul 25 '14 at 01:03

1 Answers1

3

If questions and retired have the same columns (quantity and type), then this should work:

INSERT INTO retired
SELECT * from questions where status = 'R';
Mariano D'Ascanio
  • 1,202
  • 2
  • 16
  • 17