Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Help with update query

Help with update query

Scheduled Pinned Locked Moved Database
questiondatabasehelpannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    student_rhr
    wrote on last edited by
    #1

    I have Table called Customers with CustomerId as Primay key, FirstName and LastName. I also have a table called CustomerUpdates. CustomerUpdates table has a foreign key of CustomerID. It also contains FirstName and LastName columns. How can I write a query to update the FirstName and LastName in Customers table with the FirstName and LastName in CustomerUpdates? Please help.

    P 1 Reply Last reply
    0
    • S student_rhr

      I have Table called Customers with CustomerId as Primay key, FirstName and LastName. I also have a table called CustomerUpdates. CustomerUpdates table has a foreign key of CustomerID. It also contains FirstName and LastName columns. How can I write a query to update the FirstName and LastName in Customers table with the FirstName and LastName in CustomerUpdates? Please help.

      P Offline
      P Offline
      Prakash_Mishra
      wrote on last edited by
      #2

      Hi i think, You must update one table at a time. You can update A while joining it with B to get the values you need. ie: UPDATE A SET A.myField = B.newField FROM A, B WHERE A.primaryKey = B.foreignKey Reply With Quote OR try some thing like this UPDATE CaveatsData SET CaveatsData.Title = CavTitle.Title FROM CavTitle, CaveatsData where CavTitle.RecId = CaveatsData.RecId

      Prakash Mishra(Banglore,India)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups