Updating data from one table to another in sql

I have a database with account numbers and card numbers.

I match these to a file to update any card numbers to the account number, so that I am only working with account numbers.

So I need to update the table in the new DB from the table in the old DB which has around 1000 rows.

In other words, I need to update the Unfortunately, your question is not clear.

You cannot use an update query to add new records to a database, or to delete entire records from a database.

To add new records to a database you use an append query, and to delete whole records from a database you use a delete query.

I need to update the table in Test1 from the same table in Test2 for a particular column called Dept ID, because the values in the Employee table in the Test2 DB (the old one) have been updated.So if Table B (sales) has a lead number tied to seven (7) sales, the Number of Sales column in Table A (leads) will be updated to 7.I have tried a few variations using the COUNT function but with no success. This article describes how to create and run an update query in an Access desktop database.You use an update query when you have to update or change existing data in a set of records.I am running Microsoft SQL Server 2008 R2, and pulling information from two tables to create one new table.Table A has leads with a unique lead number and other information. That should do it, and really its doing exactly what yours is.You should have indexes on tobeupdated.value and original.value EDIT: we can also simplify the query 10,000 ), so I took your and noodl's advice about the indexes and the whole query now finishes in under a second. Thanks so much for your help; I've learnt a lot!I guess it is difficult for you to state your problem in English clearly enough, bit don't despair! Post some 5-10 rows from each table, explain what should become what, and that may just be enough for us to understand what you are trying to accomplish. I've done this before using subqueries, but I knew there had to be a simpler way. Plus the answer already has an accepted answer which works. I just want to add that I only wanted to update a subset of the records in one table based on corresponding values in another table, which can easily be done by adding a condition to the WHERE clause, e.g.

Updating data from one table to another in sql