O'Reilly Answers is a community site for sharing knowledge, asking questions, and providing answers that brings together our customers, authors, editors, conference speakers, and Foo (Friends of O'Reilly). More »
If the table already exists, just use INSERT INTO ... SELECT to retrieve rows into it. If the table does not exist
yet, use CREATE TABLE ... SELECT to create it on the fly from the SELECT ...