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. SQL Query : Multiple joins [modified]

SQL Query : Multiple joins [modified]

Scheduled Pinned Locked Moved Database
databasehelpannouncement
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.
  • D Offline
    D Offline
    DotNetXenon
    wrote on last edited by
    #1

    I have 3 tables and need to update the TableC from TableA and TableB TableA OldId NewId TableB OldId OldName OldAddress TableC NewId NewName NewAddress Please help me with the joins. Thanks

    ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

    modified on Tuesday, January 19, 2010 5:30 PM

    S 1 Reply Last reply
    0
    • D DotNetXenon

      I have 3 tables and need to update the TableC from TableA and TableB TableA OldId NewId TableB OldId OldName OldAddress TableC NewId NewName NewAddress Please help me with the joins. Thanks

      ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

      modified on Tuesday, January 19, 2010 5:30 PM

      S Offline
      S Offline
      SeMartens
      wrote on last edited by
      #2

      Hi to get the values for TableC you can use this query:

      SELECT TableA.NewId, TableB.OldName, TableB.OldAddress FROM TableA INNER JOIN TableB ON TableA.OldId = TableB.OldId;

      If you want to insert the data from this query into tableC it must be something like this (not really sure):

      INSERT INTO TableC VALUES (SELECT TableA.NewId, TableB.OldName, TableB.OldAddress FROM TableA INNER JOIN TableB ON TableA.OldId = TableB.OldId);

      Hope this helps... Regards Sebastian

      It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

      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