Loading ...
Sorry, an error occurred while loading the content.

4493RE: UPDATE question

Expand Messages
  • John Warner
    Apr 5, 2010
    • 0 Attachment
      SQL Server 2005 Express

      I need to UPDATE 3 fields in a table let's call it Master.
      The data is gotten from a SELECT which fetches all 3 of the needed fields
      and quite a few rows.

      Can I do something like

      UPDATE Master
      SET field1, field2, field3

      (SELECT field1, field2, field3
      FROM tables, join ....
      WHERE prime key table1 = table2 etc) SEL

      WHERE primeKey Master = PrimeKey SEL

      Am I being clear here because the syntax is obviously not right but I hope
      shows what I'm after.

      The rows in Master will exist and the key will exist, I just need to put
      data in three fields in Master gathered from a nested query.

      Also the nested query has nested queries, each field is pulled from a
      different table and the data is pivoted so the above nest does not really
      reflect what is happening. If desired I can post just trying to save a bit
      of space.


      Thanks for the lesson I hope I'm about to receive!

      John Warner
    • Show all 18 messages in this topic