By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,842 Members | 2,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,842 IT Pros & Developers. It's quick & easy.

Update Query..

P: 2
Hello every one:

I am missing a basic concept here. Any help will be appreciated.

I have two tables with lot of fields in both, but two common fields. Even they are not the primary keys but ID is unique and distinct in both so it is safe to join table with ID field.

Let say table A has A.ID and A.DATE fields.
Table B has B.ID and B.DATE fields.

I need to update the entire A.DATE field same as B.DATE for corresponding IDs.

What would be the best solution (APPEND / INSERT / UPDATE) and why? Since I am stuck with basic here, any syntax would be helpful.


Sep 19 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 2,878
You already said it, you need to UPDATE one field with the other. So you don't have a choice but UPDATE. At least the most if you're looking for the most efficient way. Coz you can always go through creating a new table through a SELECT INTO then dropping the current one and renaming the temp table. Too complicated.

If you don't need to UPDATE the table and instead, you need to create a new TABLE with the updated fields, a SELECT INTO is your choice, but if you have triggers and constraint, it will not kick-in. If you want to enforce triggers and constraints, create the new table and do an INSERT.


-- CK
Sep 19 '08 #2

P: 2
Thanks for the explanation, a simple but very brief. That's what I needed.

Sep 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.