betweenGo

SQL Update in One Table Based on Values in Another Table

by Frank Kim on Jul.02, 2008, under Oracle

Dolphin Crest on Flickr

(Photo: Dolphin Crest by jurvetson)

I was wondering how to do this and thankfully someone wrote up a nice article on the SQL update statement.

Here is their example of how to do this.

UPDATE suppliers
SET name =
  ( SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id)
WHERE EXISTS
  ( SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id);


  • Share/Bookmark

Related posts:

  1. SQL Insert in One Table Based on Values in Another Table
  2. How to Alter Table
  3. Determining Permissions for a User
  4. HOWTO Describe A Table
  5. Retrieving the Source from the Database

:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!