Reputation: 21
I've created a SELECT query to return all of the records from my table WHERE FieldCount = 3
.
I'd now like to append the result of this query to the same table with a new value of FieldCount
.
How would you go about appending the results of a query to a table and altering the value of a field?
Upvotes: 1
Views: 2873
Reputation: 195
Create a new Query and base it off the query you just created off that table.
Notice the number 3 is the value I chose to add to the table.
Edit: Andre beat me to it, but his method is easier unless you prefer the GUI way of doing it.
Upvotes: 1
Reputation: 27634
WHERE and SELECT clause are independent of each other. You can do it like this:
INSERT INTO myTable (foo, bar, FieldCount)
SELECT foo, bar, 77 As FieldCount
FROM myTable
WHERE FieldCount = 3
Upvotes: 2