JmC
JmC

Reputation: 21

Append a table with the result of a select query

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

Answers (2)

Huntdogg
Huntdogg

Reputation: 195

Create a new Query and base it off the query you just created off that table.

  • Make sure that the new query is an append query
  • Add all the fields to the query in design mode
  • For the new "FieldCount" number, Just place whatever number you want them all to be in the field combobox.

Notice the number 3 is the value I chose to add to the table.

Append Query

Results in Table

Edit: Andre beat me to it, but his method is easier unless you prefer the GUI way of doing it.

Upvotes: 1

Andre
Andre

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

Related Questions