Wednesday, February 28, 2007

Inserting based on Select

I often forget this syntax.

INSERT tablename (value1, value2)
SELECT value1, value2
FROM someothertable
WHERE somewhereclause

I often forget this syntax. It of course inserts the row or rows returned by the select into the table given on the insert line.

1 comment:

Unknown said...

Boy, this sure is a short post. You criticized me for the same- why would that be?