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. Update DB Table based on another temp Table data

Update DB Table based on another temp Table data

Scheduled Pinned Locked Moved Database
databasequestiondiscussionannouncement
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
    Sachin k Rajput
    wrote on last edited by
    #1

    I'm having a temp table in which I'm inserting data. In temp table data is ok and I want to update another table with temp table data. I'm new to SQL My Query is: update result_table set result_table.a = temp.a, result_table.b = temp.b from temp where temp.a= 1 I'm deleting the data in temp table and inserting data again in temp table and updating the result table. How can I do this? Please share your opinions. Thanks!

    P 1 Reply Last reply
    0
    • S Sachin k Rajput

      I'm having a temp table in which I'm inserting data. In temp table data is ok and I want to update another table with temp table data. I'm new to SQL My Query is: update result_table set result_table.a = temp.a, result_table.b = temp.b from temp where temp.a= 1 I'm deleting the data in temp table and inserting data again in temp table and updating the result table. How can I do this? Please share your opinions. Thanks!

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

      You probaly want a JOIN in the FROM part -- JOIN the result_table to temp ON some key you haven't mentioned.

      You'll never get very far if all you do is follow instructions.

      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